Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unused firing modes from TAG #3910

Merged
merged 1 commit into from
Sep 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions megamek/src/megamek/common/TagInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,12 @@ public class TagInfo implements Serializable {
public int attackerId; // who fired the TAG
public int targetType; // keeps track of the target's type
public Targetable target; // entity the tag was fired at
public int priority; // how many homing missiles to grab at a time
public boolean missed; // did the TAG hit?
public int shots = 0; // number of homing missiles allocated

public TagInfo(int attackerId, int targetType, Targetable target,
int priority, boolean missed) {
public TagInfo(int attackerId, int targetType, Targetable target, boolean missed) {
this.attackerId = attackerId;
this.targetType = targetType;
this.target = target;
this.priority = priority;
this.missed = missed;
this.shots = priority;
}
}
39 changes: 3 additions & 36 deletions megamek/src/megamek/common/weapons/TAGHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,9 @@ protected void handleEntityDamage(Entity entityTarget, Vector<Report> vPhaseRepo
r.subject = subjectId;
vPhaseReport.addElement(r);
} else {
int priority = 1;
EquipmentMode mode = (weapon.curMode());
if (mode != null) {
if (mode.getName() == "1-shot") {
priority = 1;
} else if (mode.getName() == "2-shot") {
priority = 2;
} else if (mode.getName() == "3-shot") {
priority = 3;
} else if (mode.getName() == "4-shot") {
priority = 4;
}
}
if (priority < 1) {
priority = 1;
}
// it is possible for 2 or more tags to hit the same entity

TagInfo info = new TagInfo(ae.getId(), Targetable.TYPE_ENTITY,
entityTarget, priority, false);
entityTarget, false);
game.addTagInfo(info);
entityTarget.setTaggedBy(ae.getId());

Expand All @@ -88,25 +72,8 @@ protected void handleEntityDamage(Entity entityTarget, Vector<Report> vPhaseRepo
@Override
protected boolean handleSpecialMiss(Entity entityTarget, boolean bldgDamagedOnMiss,
Building bldg, Vector<Report> vPhaseReport) {
int priority = 1;
EquipmentMode mode = (weapon.curMode());
if (mode != null) {
switch (mode.getName()) {
case "2-shot":
priority = 2;
break;
case "3-shot":
priority = 3;
break;
case "4-shot":
priority = 4;
break;
default:
break;
}
}
// add even misses, as they waste homing missiles.
TagInfo info = new TagInfo(ae.getId(), target.getTargetType(), target, priority, true);
TagInfo info = new TagInfo(ae.getId(), target.getTargetType(), target, true);
game.addTagInfo(info);
return false;
}
Expand Down
16 changes: 2 additions & 14 deletions megamek/src/megamek/common/weapons/WeaponHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -1090,21 +1090,9 @@ public boolean handle(GamePhase phase, Vector<Report> returnedReports) {
int nDamage;
if ((target.getTargetType() == Targetable.TYPE_HEX_TAG)
|| (target.getTargetType() == Targetable.TYPE_BLDG_TAG)) {
int priority = 1;
EquipmentMode mode = (weapon.curMode());
if (mode != null) {
if (mode.getName() == "1-shot") {
priority = 1;
} else if (mode.getName() == "2-shot") {
priority = 2;
} else if (mode.getName() == "3-shot") {
priority = 3;
} else if (mode.getName() == "4-shot") {
priority = 4;
}
}

TagInfo info = new TagInfo(ae.getId(),
target.getTargetType(), target, priority, false);
target.getTargetType(), target, false);
game.addTagInfo(info);

ae.setSpotting(true);
Expand Down
1 change: 0 additions & 1 deletion megamek/src/megamek/common/weapons/tag/TAGWeapon.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public TAGWeapon() {
super();
flags = flags.or(F_MECH_WEAPON).or(F_TANK_WEAPON).or(F_AERO_WEAPON)
.or(F_TAG).or(F_NO_FIRES);
setModes(new String[] { "1-shot", "2-shot", "3-shot", "4-shot" });
}

@Override
Expand Down