Search in sources :

Example 1 with SicknessEffect

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);
}
Also used : ISickness(ladysnake.pathos.api.ISickness) SicknessEffect(ladysnake.pathos.api.SicknessEffect)

Example 2 with SicknessEffect

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);
}
Also used : IBreathingHandler(ladysnake.gaspunk.api.IBreathingHandler) LingeringAgent(ladysnake.gaspunk.gas.agent.LingeringAgent) ISicknessHandler(ladysnake.pathos.api.ISicknessHandler) SicknessEffect(ladysnake.pathos.api.SicknessEffect) Test(org.junit.Test)

Aggregations

SicknessEffect (ladysnake.pathos.api.SicknessEffect)2 IBreathingHandler (ladysnake.gaspunk.api.IBreathingHandler)1 LingeringAgent (ladysnake.gaspunk.gas.agent.LingeringAgent)1 ISickness (ladysnake.pathos.api.ISickness)1 ISicknessHandler (ladysnake.pathos.api.ISicknessHandler)1 Test (org.junit.Test)1