Search in sources :

Example 1 with LingeringAgent

use of ladysnake.gaspunk.gas.agent.LingeringAgent in project Gaspunk by Ladysnake.

the class GasAgents method createSicknessAgent.

public static IGasAgent createSicknessAgent(String name, Supplier<LingeringAgent> agentSupplier, Supplier<ISickness> sicknessSupplier) {
    LingeringAgent agent = name(agentSupplier.get(), name);
    ISickness sickness = sicknessSupplier.get();
    ResourceLocation id = new ResourceLocation(GasPunk.MOD_ID, name);
    sickness.setRegistryName(id);
    LINGERING_EFFECTS.put(agent, sickness);
    AGENT_MAP.put(id, agent);
    return agent;
}
Also used : ISickness(ladysnake.pathos.api.ISickness) LingeringAgent(ladysnake.gaspunk.gas.agent.LingeringAgent) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 2 with LingeringAgent

use of ladysnake.gaspunk.gas.agent.LingeringAgent 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

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