mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
added pulmonary fibrosis
This commit is contained in:
parent
fa88b16c4c
commit
6e32c9818d
@ -2,6 +2,7 @@ package com.hbm.blocks.gas;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.extprop.HbmLivingProps;
|
||||
import com.hbm.util.ArmorUtil;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
@ -24,6 +25,7 @@ public class BlockGasRadon extends BlockGasBase {
|
||||
|
||||
if(entity instanceof EntityLivingBase) {
|
||||
ContaminationUtil.contaminate((EntityLivingBase)entity, HazardType.RADIATION, ContaminationType.RAD_BYPASS, 0.05F);
|
||||
HbmLivingProps.incrementFibrosis((EntityLivingBase)entity, 5);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.blocks.gas;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.extprop.HbmLivingProps;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.util.ArmorRegistry;
|
||||
@ -40,6 +41,7 @@ public class BlockGasRadonDense extends BlockGasBase {
|
||||
} else {
|
||||
ContaminationUtil.contaminate((EntityLivingBase)entity, HazardType.RADIATION, ContaminationType.CREATIVE, 0.5F);
|
||||
entityLiving.addPotionEffect(new PotionEffect(HbmPotion.radiation.id, 15 * 20, 0));
|
||||
HbmLivingProps.incrementFibrosis(entityLiving, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package com.hbm.blocks.gas;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.extprop.HbmLivingProps;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
import com.hbm.util.ContaminationUtil.ContaminationType;
|
||||
import com.hbm.util.ContaminationUtil.HazardType;
|
||||
@ -52,6 +53,7 @@ public class BlockGasRadonTomb extends BlockGasBase {
|
||||
|
||||
if(entity instanceof EntityLivingBase) {
|
||||
ContaminationUtil.contaminate((EntityLivingBase)entity, HazardType.RADIATION, ContaminationType.RAD_BYPASS, 0.5F);
|
||||
HbmLivingProps.incrementFibrosis((EntityLivingBase)entity, 20);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -35,6 +35,8 @@ public class HbmLivingProps implements IExtendedEntityProperties {
|
||||
public static final int maxAsbestos = 60 * 60 * 20;
|
||||
private int blacklung;
|
||||
public static final int maxBlacklung = 60 * 60 * 20;
|
||||
private int Fibrosis;
|
||||
public static final int maxFibrosis = 60 * 60 * 30;
|
||||
private float radEnv;
|
||||
private float radBuf;
|
||||
private int bombTimer;
|
||||
@ -185,6 +187,7 @@ public class HbmLivingProps implements IExtendedEntityProperties {
|
||||
|
||||
public static void incrementAsbestos(EntityLivingBase entity, int asbestos) {
|
||||
setAsbestos(entity, getAsbestos(entity) + asbestos);
|
||||
incrementFibrosis(entity, asbestos);
|
||||
}
|
||||
|
||||
|
||||
@ -197,13 +200,32 @@ public class HbmLivingProps implements IExtendedEntityProperties {
|
||||
getData(entity).blacklung = blacklung;
|
||||
|
||||
if(blacklung >= maxBlacklung) {
|
||||
getData(entity).asbestos = 0;
|
||||
getData(entity).blacklung = 0;
|
||||
entity.attackEntityFrom(ModDamageSource.asbestos, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementBlackLung(EntityLivingBase entity, int blacklung) {
|
||||
setBlackLung(entity, getBlackLung(entity) + blacklung);
|
||||
incrementFibrosis(entity, blacklung);
|
||||
}
|
||||
|
||||
/// PULMONARY FIBROSIS ///
|
||||
public static int getFibrosis(EntityLivingBase entity) {
|
||||
return getData(entity).Fibrosis;
|
||||
}
|
||||
|
||||
public static void setFibrosis(EntityLivingBase entity, int fibrosis) {
|
||||
getData(entity).Fibrosis = fibrosis;
|
||||
|
||||
if (fibrosis >= maxFibrosis) {
|
||||
getData(entity).Fibrosis = 0;
|
||||
entity.attackEntityFrom(ModDamageSource.asbestos, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
public static void incrementFibrosis(EntityLivingBase entity, int fibrosis) {
|
||||
setFibrosis(entity, getFibrosis(entity) + fibrosis);
|
||||
}
|
||||
|
||||
/// TIME BOMB ///
|
||||
|
||||
@ -328,6 +328,7 @@ public class EntityEffectHandler {
|
||||
if(entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode) {
|
||||
HbmLivingProps.setBlackLung(entity, 0);
|
||||
HbmLivingProps.setAsbestos(entity, 0);
|
||||
HbmLivingProps.setFibrosis(entity, 0);
|
||||
|
||||
return;
|
||||
} else {
|
||||
@ -340,8 +341,9 @@ public class EntityEffectHandler {
|
||||
|
||||
double blacklung = Math.min(HbmLivingProps.getBlackLung(entity), HbmLivingProps.maxBlacklung);
|
||||
double asbestos = Math.min(HbmLivingProps.getAsbestos(entity), HbmLivingProps.maxAsbestos);
|
||||
double fibrosis = Math.min(HbmLivingProps.getFibrosis(entity), HbmLivingProps.maxFibrosis);
|
||||
|
||||
boolean coughs = blacklung / HbmLivingProps.maxBlacklung > 0.25D || asbestos / HbmLivingProps.maxAsbestos > 0.25D;
|
||||
boolean coughs = blacklung / HbmLivingProps.maxBlacklung > 0.25D || asbestos / HbmLivingProps.maxAsbestos > 0.25D || fibrosis / HbmLivingProps.maxFibrosis > 0.25D;
|
||||
|
||||
if(!coughs)
|
||||
return;
|
||||
@ -349,11 +351,13 @@ public class EntityEffectHandler {
|
||||
boolean coughsCoal = blacklung / HbmLivingProps.maxBlacklung > 0.5D;
|
||||
boolean coughsALotOfCoal = blacklung / HbmLivingProps.maxBlacklung > 0.8D;
|
||||
boolean coughsBlood = asbestos / HbmLivingProps.maxAsbestos > 0.75D || blacklung / HbmLivingProps.maxBlacklung > 0.75D;
|
||||
boolean asthmaAttack = fibrosis / HbmLivingProps.maxFibrosis > 0.30D;
|
||||
|
||||
double blacklungDelta = 1D - (blacklung / (double)HbmLivingProps.maxBlacklung);
|
||||
double asbestosDelta = 1D - (asbestos / (double)HbmLivingProps.maxAsbestos);
|
||||
double fibrosisDelta = 1D - (fibrosis / (double)HbmLivingProps.maxFibrosis);
|
||||
|
||||
double total = 1 - (blacklungDelta * asbestosDelta);
|
||||
double total = 1 - (blacklungDelta * asbestosDelta * fibrosisDelta);
|
||||
|
||||
int freq = Math.max((int) (1000 - 950 * total), 20);
|
||||
|
||||
@ -377,6 +381,10 @@ public class EntityEffectHandler {
|
||||
nbt.setInteger("count", 5);
|
||||
nbt.setInteger("entity", entity.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
if(asthmaAttack) {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 40, 1));
|
||||
entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 1));
|
||||
}
|
||||
}
|
||||
|
||||
if(coughsCoal) {
|
||||
@ -386,6 +394,15 @@ public class EntityEffectHandler {
|
||||
nbt.setInteger("count", coughsALotOfCoal ? 50 : 10);
|
||||
nbt.setInteger("entity", entity.getEntityId());
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(nbt, 0, 0, 0), new TargetPoint(entity.dimension, entity.posX, entity.posY, entity.posZ, 25));
|
||||
if(asthmaAttack) {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 40, 1));
|
||||
entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 1));
|
||||
}
|
||||
}
|
||||
|
||||
if(asthmaAttack) {
|
||||
entity.addPotionEffect(new PotionEffect(Potion.confusion.id, 40, 1));
|
||||
entity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user