use of ladysnake.pathos.api.SicknessEffect in project Gaspunk by Ladysnake.
the class SicknessMessage method fromBytes.
@Override
public void fromBytes(ByteBuf buf) {
ISickness sickness = Sickness.REGISTRY.getValue(buf.readInt());
float severity = buf.readFloat();
int ticksSinceBeginning = buf.readInt();
int ticksSinceLastPerform = buf.readInt();
effect = new SicknessEffect(sickness, severity, ticksSinceBeginning, ticksSinceLastPerform);
}
use of ladysnake.pathos.api.SicknessEffect in project Gaspunk by Ladysnake.
the class SicknessTests method testSarinTick2.
@Test
public void testSarinTick2() {
IBreathingHandler breathingHandler = CapabilityBreathing.getHandler(mockedCreeper).get();
final float concentration = 0.5f;
final float time = 5;
for (int i = 0; i < time; i++) {
breathingHandler.setConcentration(ModGases.SARIN_GAS, concentration);
breathingHandler.tick();
}
ISicknessHandler sicknessHandler = CapabilitySickness.getHandler(mockedCreeper).get();
LingeringAgent sarinAgent = (LingeringAgent) GasAgents.NERVE;
SicknessEffect effect = sicknessHandler.getActiveEffect(GasAgents.LINGERING_EFFECTS.get(sarinAgent));
float potency = ModGases.SARIN_GAS.getAgents().get(0).getPotency();
float toxicityPerTick = potency * concentration / 20;
float oracle = toxicityPerTick * time;
assertEquals(oracle, effect.getSeverity(), 1E-8f);
}
Aggregations