/** * Returns the weight of the engine in tons, rounded to the next highest half * ton. * * @return the weight of the engine. */ public double getWeightEngine(Entity entity) { return getWeightEngine(entity, TestEntity.Ceil.HALFTON); }
@Override public double getWeightEngine() { return proto.getEngine().getWeightEngine(proto, Ceil.KILO); }
public double getWeightEngine() { double weight = ((null != engine) ? engine.getWeightEngine(getEntity(), getWeightCeilingEngine()) : 0); return weight; }
public double getVehicleFuelCost(Entity e) { Engine en = e.getEngine(); if (e instanceof SupportTank) { if (en.getEngineType() == Engine.FUEL_CELL) { return (((SupportTank) e).getFuelTonnage() * 15000 * 4); } else if (en.getEngineType() == Engine.COMBUSTION_ENGINE) { return (((SupportTank) e).getFuelTonnage() * 1000 * 4); } else { return 0; } } else { if (en.getEngineType() == Engine.FUEL_CELL) { return (en.getWeightEngine(e) *.1 * 15000 * 4); } else if (en.getEngineType() == Engine.COMBUSTION_ENGINE) { return (en.getWeightEngine(e) *.1 * 1000 * 4); } else { return 0; } } }
@Test public void testEngineWeight() { Entity mockProto = mock(Entity.class); when(mockProto.hasETypeFlag(anyLong())) .thenAnswer(inv -> (((Long) inv.getArgument(0)) & Entity.ETYPE_PROTOMECH) != 0); Entity mockNonProto = mock(Entity.class); when(mockNonProto.hasETypeFlag(anyLong())).thenReturn(false); Engine engine45 = new Engine(45, Engine.NORMAL_ENGINE, Engine.CLAN_ENGINE); Engine engine42 = new Engine(42, Engine.NORMAL_ENGINE, Engine.CLAN_ENGINE); Engine engine40 = new Engine(40, Engine.NORMAL_ENGINE, Engine.CLAN_ENGINE); Engine engine35 = new Engine(35, Engine.NORMAL_ENGINE, Engine.CLAN_ENGINE); assertEquals(engine42.getWeightEngine(mockProto, TestEntity.Ceil.KILO), engine45.getWeightEngine(mockNonProto), 0.001); assertEquals(engine40.getWeightEngine(mockProto, TestEntity.Ceil.KILO), engine40.getWeightEngine(mockNonProto), 0.001); assertTrue(engine35.getWeightEngine(mockProto, TestEntity.Ceil.KILO) < engine35.getWeightEngine(mockNonProto)); }
@Test public void testExcessWeight() { Protomech mockProto = createGenericMockProto(); Engine engine = new Engine(30, Engine.NORMAL_ENGINE, Engine.CLAN_ENGINE); when(mockProto.getEngine()).thenReturn(engine); double engineWeight = engine.getWeightEngine(mockProto); when(mockProto.getWeight()).thenReturn(engineWeight); TestProtomech test = new TestProtomech(mockProto, option, null); assertFalse(test.correctWeight(new StringBuffer())); }
} else { if (hasSubType(S_JETBOOSTER)) { return entity.hasEngine() ? entity.getEngine().getWeightEngine(entity) / 10.0f : 0.0f; return 0.0f; return Math.ceil((e.getWeightEngine(entity) / 10.0f) * 2.0f) / 2.0; } else if (hasFlag(F_JET_BOOSTER)) { Engine e = entity.getEngine(); return Math.ceil((e.getWeightEngine(entity) *.1 ) * 2.0f) / 2.0; } else if ((hasFlag(F_HAND_WEAPON) && hasSubType(S_CLAW)) || hasFlag(F_TALON)) { return Math.ceil(entity.getWeight() / 15);
if(hasEngine()) { if (isSupportVehicle()) { engineCost = 5000 * getEngine().getWeightEngine(this); switch (getEngine().getEngineType()) { case Engine.STEAM: