📄 infantry.java
字号:
dBV = 23; else if ( IEntityMovementMode.INF_MOTORIZED == this.getMovementMode() ) dBV = 28; else if ( IEntityMovementMode.INF_JUMP == this.getMovementMode() ) dBV = 29; else throw new IllegalArgumentException ( "Unknown movement type: " + this.getMovementMode() ); } else if (this.weapons == INF_MG) { if ( IEntityMovementMode.INF_LEG == this.getMovementMode() ) dBV = 31; else if ( IEntityMovementMode.INF_MOTORIZED == this.getMovementMode() ) dBV = 39; else if ( IEntityMovementMode.INF_JUMP == this.getMovementMode() ) dBV = 37; else throw new IllegalArgumentException ( "Unknown movement type: " + this.getMovementMode() ); } else if (this.weapons == INF_FLAMER) { if ( IEntityMovementMode.INF_LEG == this.getMovementMode() ) dBV = 28; else if ( IEntityMovementMode.INF_MOTORIZED == this.getMovementMode() ) dBV = 35; else if ( IEntityMovementMode.INF_JUMP == this.getMovementMode() ) dBV = 32; else throw new IllegalArgumentException ( "Unknown movement type: " + this.getMovementMode() ); } else if (this.weapons == INF_LASER) { if ( IEntityMovementMode.INF_LEG == this.getMovementMode() ) dBV = 37; else if ( IEntityMovementMode.INF_MOTORIZED == this.getMovementMode() ) dBV = 42; else if ( IEntityMovementMode.INF_JUMP == this.getMovementMode() ) dBV = 41; else throw new IllegalArgumentException ( "Unknown movement type: " + this.getMovementMode() ); } else if (this.weapons == INF_SRM) { if ( IEntityMovementMode.INF_LEG == this.getMovementMode() ) dBV = 60; else if ( IEntityMovementMode.INF_MOTORIZED == this.getMovementMode() ) dBV = 70; else if ( IEntityMovementMode.INF_JUMP == this.getMovementMode() ) dBV = 71; else throw new IllegalArgumentException ( "Unknown movement type: " + this.getMovementMode() ); } else if (this.weapons == INF_LRM) { if ( IEntityMovementMode.INF_LEG == this.getMovementMode() ) dBV = 56; else if ( IEntityMovementMode.INF_MOTORIZED == this.getMovementMode() ) dBV = 75; else if ( IEntityMovementMode.INF_JUMP == this.getMovementMode() ) dBV = 87; else throw new IllegalArgumentException ( "Unknown movement type: " + this.getMovementMode() ); } else throw new IllegalArgumentException ( "Unknown infantry weapon: " + this.weapons ); } // End not-anti-Mek // add BV of field guns for(Mounted mounted : getWeaponList()) { WeaponType wtype = (WeaponType)mounted.getType(); if(!wtype.hasFlag(WeaponType.F_INFANTRY)) dBV += wtype.getBV(this); } // Adjust for missing troopers dBV = dBV * getInternalRemainingPercent(); // Possibly adjust for TAG and Arrow IV. if (getsTagBVPenalty()) { dBV += 200; } if (getsHomingBVPenalty()) { dBV += 200; } // adjust for crew double pilotFactor = crew.getBVSkillMultiplier(); int finalBV = (int)Math.round(dBV); int retVal = (int)Math.round((finalBV) * pilotFactor); return retVal; } // End public int calculateBattleValue() public Vector victoryReport() { Vector vDesc = new Vector(); Report r = new Report(7025); r.type = Report.PUBLIC; r.addDesc(this); vDesc.addElement(r); r = new Report(7040); r.type = Report.PUBLIC; r.newlines = 0; vDesc.addElement(r); vDesc.addAll(crew.getDescVector(true)); r = new Report(7070, Report.PUBLIC); r.add(getKillNumber()); vDesc.addElement(r); if(isDestroyed()) { Entity killer = game.getEntity(killerId); if(killer == null) { killer = game.getOutOfGameEntity(killerId); } if(killer != null) { r = new Report(7072, Report.PUBLIC); r.addDesc(killer); } else { r = new Report(7073, Report.PUBLIC); } vDesc.addElement(r); } r.newlines = 2; return vDesc; } /** * Infantry don't need piloting rolls. */ public PilotingRollData addEntityBonuses(PilotingRollData prd) { return prd; } /** * Infantry can only change 1 elevation level at a time. */ public int getMaxElevationChange() { return 1; } /** * Update the platoon to reflect damages taken in this phase. */ public void applyDamage() { super.applyDamage(); menShooting = men; } // The methods below aren't in the Entity interface. /** * Determine the amount of damage that the infantry can produce, * given a number of men left in the platoon. * * @param menLeft - the number of men in the platoon capable of shooting. * @return <code>int</code> - the amount of damage done when the platoon * hits its target. */ public int getDamage( int menLeft ) { return damage[menLeft]; } /** * Get the number of men in the platoon (before damage is applied). */ public int getShootingStrength() { return menShooting; } public boolean canCharge() { // Infantry can't Charge return false; } public boolean canDFA() { // Infantry can't DFA return false; } /** * Sets this entity's original walking movement points */ public void setOriginalRunMP(int runMP) { this.runMP = runMP; } /** * @return The cost in C-Bills of the 'Mech in question. */ public double getCost() { double cost = 0; double multiplier = 0; if ( this.antiMek ) { multiplier = 5; } else { multiplier = 1; } if (this.weapons == INF_RIFLE) { if ( IEntityMovementMode.INF_LEG == this.getMovementMode() ) cost = 600000; else if ( IEntityMovementMode.INF_MOTORIZED == this.getMovementMode() ) cost = 960000; else if ( IEntityMovementMode.INF_JUMP == this.getMovementMode() ) cost = 1200000; else throw new IllegalArgumentException ( "Unknown movement type: " + this.getMovementMode() ); } else if (this.weapons == INF_MG) { if ( IEntityMovementMode.INF_LEG == this.getMovementMode() ) cost = 800000; else if ( IEntityMovementMode.INF_MOTORIZED == this.getMovementMode() ) cost = 1280000; else if ( IEntityMovementMode.INF_JUMP == this.getMovementMode() ) cost = 1600000; else throw new IllegalArgumentException ( "Unknown movement type: " + this.getMovementMode() ); } else if (this.weapons == INF_FLAMER) { if ( IEntityMovementMode.INF_LEG == this.getMovementMode() ) cost = 800000; else if ( IEntityMovementMode.INF_MOTORIZED == this.getMovementMode() ) cost = 1280000; else if ( IEntityMovementMode.INF_JUMP == this.getMovementMode() ) cost = 1600000; else throw new IllegalArgumentException ( "Unknown movement type: " + this.getMovementMode() ); } else if (this.weapons == INF_LASER) { if ( IEntityMovementMode.INF_LEG == this.getMovementMode() ) cost = 1200000; else if ( IEntityMovementMode.INF_MOTORIZED == this.getMovementMode() ) cost = 1920000; else if ( IEntityMovementMode.INF_JUMP == this.getMovementMode() ) cost = 2400000; else throw new IllegalArgumentException ( "Unknown movement type: " + this.getMovementMode() ); } else if (this.weapons == INF_SRM) { if ( IEntityMovementMode.INF_LEG == this.getMovementMode() ) cost = 1400000; else if ( IEntityMovementMode.INF_MOTORIZED == this.getMovementMode() ) cost = 2240000; else if ( IEntityMovementMode.INF_JUMP == this.getMovementMode() ) cost = 2800000; else throw new IllegalArgumentException ( "Unknown movement type: " + this.getMovementMode() ); } else if (this.weapons == INF_LRM) { if ( IEntityMovementMode.INF_LEG == this.getMovementMode() ) cost = 1400000; else if ( IEntityMovementMode.INF_MOTORIZED == this.getMovementMode() ) cost = 2240000; else if ( IEntityMovementMode.INF_JUMP == this.getMovementMode() ) cost = 2800000; else throw new IllegalArgumentException ( "Unknown movement type: " + this.getMovementMode() ); } else throw new IllegalArgumentException ( "Unknown infantry weapon: " + this.weapons ); // End not-anti-Mek return cost*multiplier; } public boolean doomedInVacuum() { // We're assuming that infantry have environmental suits of some sort. // Vac suits, battle armor, whatever. // This isn't necessarily a true assumption. // FIXME return false; } public boolean canAssaultDrop() { return game.getOptions().booleanOption("paratroopers"); } public boolean isEligibleFor(int phase) { if(turnsLayingExplosives > 0 && phase != IGame.PHASE_PHYSICAL) return false; if(dugIn != DUG_IN_COMPLETE && dugIn != DUG_IN_NONE) { return false; } return super.isEligibleFor(phase); } public void newRound(int roundNumber) { if(turnsLayingExplosives >= 0) { turnsLayingExplosives++; if(!(Compute.isInBuilding(game, this))) turnsLayingExplosives = -1; //give up if no longer in a building } if(dugIn != DUG_IN_COMPLETE && dugIn != DUG_IN_NONE) { dugIn++; if(dugIn > DUG_IN_FORTIFYING2) { dugIn = DUG_IN_NONE; } } super.newRound(roundNumber); } public boolean loadWeapon(Mounted mounted, Mounted mountedAmmo) { if(!(this instanceof BattleArmor)) { //field guns don't share ammo, and infantry weapons dont have ammo if(mounted.getLinked() != null || mountedAmmo.getLinkedBy() != null) return false; } return super.loadWeapon(mounted, mountedAmmo); } public boolean loadWeaponWithSameAmmo(Mounted mounted, Mounted mountedAmmo) { if(!(this instanceof BattleArmor)) { //field guns don't share ammo, and infantry weapons dont have ammo if(mounted.getLinked() != null || mountedAmmo.getLinkedBy() != null) return false; } return super.loadWeaponWithSameAmmo(mounted, mountedAmmo); } public void setDugIn(int i) { dugIn = i; } public int getDugIn() { return dugIn; } public boolean isNuclearHardened() { return false; }} // End class Infantry
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -