📄 gunemplacement.java
字号:
effect = HitData.EFFECT_GUN_EMPLACEMENT_WEAPONS; break; case 3: case 11: if (hasTurret()) { armorLoc = LOC_TURRET; effect = HitData.EFFECT_GUN_EMPLACEMENT_TURRET; } break; case 4: case 5: case 9: case 10: if (hasTurret()) { armorLoc = LOC_TURRET; } break; case 12: // ASSUMTION: damage goes to main building effect = HitData.EFFECT_GUN_EMPLACEMENT_CREW; break; } return new HitData(armorLoc, false, effect); } /** * Gets the location that excess damage transfers to */ public HitData getTransferLocation(HitData hit) { return (hit.getLocation() == LOC_TURRET) ? new HitData(LOC_BUILDING) : new HitData(LOC_DESTROYED); } /** * Gets the location that is destroyed recursively */ public int getDependentLocation(int loc) { return (loc == LOC_BUILDING) ? LOC_TURRET : LOC_NONE; } /** * Calculates the battle value of this emplacement */ public int calculateBattleValue() { return calculateBattleValue(false); } /** * Calculates the battle value of this emplacement */ public int calculateBattleValue(boolean assumeLinkedC3) { // using structures BV rules from MaxTech double dbv = 0; // defensive battle value double obv = 0; // offensive bv // total armor points dbv += getTotalArmor(); // add defensive equipment double dEquipmentBV = 0; for (Mounted mounted : getEquipment()) { EquipmentType etype = mounted.getType(); // don't count destroyed equipment if (mounted.isDestroyed()) continue; if ((etype instanceof WeaponType && etype.hasFlag(WeaponType.F_AMS)) || (etype instanceof AmmoType && ((AmmoType)etype).getAmmoType() == AmmoType.T_AMS) || etype.hasFlag(MiscType.F_ECM)) { dEquipmentBV += etype.getBV(this); } } dbv += dEquipmentBV; dbv *= 0.5; // structure modifier double weaponBV = 0; // figure out base weapon bv //double weaponsBVFront = 0; //double weaponsBVRear = 0; boolean hasTargComp = hasTargComp(); for (Mounted mounted : getWeaponList()) { WeaponType wtype = (WeaponType)mounted.getType(); double dBV = wtype.getBV(this); // don't count destroyed equipment if (mounted.isDestroyed()) continue; // don't count AMS, it's defensive if (wtype.hasFlag(WeaponType.F_AMS)) { continue; } // artemis bumps up the value if (mounted.getLinkedBy() != null) { Mounted mLinker = mounted.getLinkedBy(); if (mLinker.getType() instanceof MiscType && mLinker.getType().hasFlag(MiscType.F_ARTEMIS)) { dBV *= 1.2; } } // and we'll add the tcomp here too if (wtype.hasFlag(WeaponType.F_DIRECT_FIRE) && hasTargComp) { dBV *= 1.2; } //if not turret mounted, 1/2 BV if(mounted.getLocation() != LOC_TURRET) dBV *= 0.5; weaponBV += dBV; } obv += weaponBV; // add ammo bv double ammoBV = 0; for (Mounted mounted : getAmmo()) { AmmoType atype = (AmmoType)mounted.getType(); // don't count depleted ammo if (mounted.getShotsLeft() == 0) continue; // don't count AMS, it's defensive if (atype.getAmmoType() == AmmoType.T_AMS) { continue; } ammoBV += atype.getBV(this); } obv += ammoBV; // we get extra bv from c3 networks. a valid network requires at least 2 members // some hackery and magic numbers here. could be better // also, each 'has' loops through all equipment. inefficient to do it 3 times double xbv = 0.0; if ((hasC3MM() && calculateFreeC3MNodes() < 2) || (hasC3M() && calculateFreeC3Nodes() < 3) || (hasC3S() && C3Master > NONE) || (hasC3i() && calculateFreeC3Nodes() < 5) || assumeLinkedC3) { xbv = Math.round(0.35 * weaponBV); } // Possibly adjust for TAG and Arrow IV. if (getsTagBVPenalty()) { dbv += 200; } if (getsHomingBVPenalty()) { dbv += 200; } // and then factor in pilot double pilotFactor = crew.getBVSkillMultiplier(); // structure modifier obv *= 0.44; //return (int)Math.round((dbv + obv + xbv) * pilotFactor); int finalBV = (int)Math.round(dbv + obv + xbv); int retVal = (int)Math.round((finalBV) * pilotFactor); return retVal; } public PilotingRollData addEntityBonuses(PilotingRollData prd) { return prd; } 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(7035); r.type = Report.PUBLIC; r.newlines = 0; vDesc.addElement(r); vDesc.addAll(crew.getDescVector(false)); 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; } public int[] getNoOfSlots() { return CRITICAL_SLOTS; } public int getRunMPwithoutMASC(boolean gravity) { return 0; } public int getHeatCapacity() { return 999; } public int getHeatCapacityWithWater() { return getHeatCapacity(); } public int getEngineCritHeat() { return 0; } public void autoSetInternal() { initializeInternal(0, LOC_BUILDING); if (hasTurret()) { initializeInternal(0, LOC_TURRET); } } public int getMaxElevationChange() { return 0; } public boolean isRepairable() { boolean retval = this.isSalvage(); int loc = 0; while ( retval && loc < LOC_TURRET ) { int loc_is = this.getInternal( loc ); loc++; retval = (loc_is != IArmorState.ARMOR_DOOMED) && (loc_is != IArmorState.ARMOR_DESTROYED); } return retval; } public boolean canCharge() { return false; } public boolean canDFA() { return false; } public boolean canFlee() { return false; } public boolean canFlipArms() { return false; } public boolean canGoDown() { return false; } public boolean canGoDown(int assumed, Coords coords) { return false; } public double getCost() { // XXX no idea return 0; } public boolean doomedInVacuum() { for (Mounted m : getEquipment()) { if (m.getType() instanceof MiscType && m.getType().hasFlag(MiscType.F_VACUUM_PROTECTION)) { return false; } } return true; } public boolean isNuclearHardened() { return true; } protected void addEquipment(Mounted mounted, int loc, boolean rearMounted) throws LocationFullException { super.addEquipment(mounted,loc, rearMounted); // Add the piece equipment to our slots. addCritical(loc, new CriticalSlot(CriticalSlot.TYPE_EQUIPMENT, getEquipmentNum(mounted), true)); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -