Skip to content

Commit

Permalink
fix: Increased the tick rate of continuous spells (#849)
Browse files Browse the repository at this point in the history
... and added some checks to make sure the spells don't deal too much with mods that interact with the hurt resistance timer.
  • Loading branch information
ipdnaeip authored Sep 9, 2023
1 parent 85ca4fd commit 112a562
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/electroblob/wizardry/spell/FireBreath.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivin
this.getNameForTranslationFormatted()), true);
// This now only damages in line with the maxHurtResistantTime. Some mods don't play nicely and fiddle
// with this mechanic for their own purposes, so this line makes sure that doesn't affect wizardry.
}else if(ticksInUse % ((EntityLivingBase)target).maxHurtResistantTime == 1){
}else if(ticksInUse % 10 == 0){
target.setFire((int)(getProperty(BURN_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)));
EntityUtils.attackEntityWithoutKnockback(target,
MagicDamage.causeDirectMagicDamage(caster, DamageType.FIRE),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/electroblob/wizardry/spell/FlameRay.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivin
this.getNameForTranslationFormatted()), true);
// This now only damages in line with the maxHurtResistantTime. Some mods don't play nicely and fiddle
// with this mechanic for their own purposes, so this line makes sure that doesn't affect wizardry.
}else if(ticksInUse % ((EntityLivingBase)target).maxHurtResistantTime == 1){
}else if(ticksInUse % 10 == 0){
target.setFire((int)(getProperty(BURN_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)));
EntityUtils.attackEntityWithoutKnockback(target,
MagicDamage.causeDirectMagicDamage(caster, DamageType.FIRE),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/electroblob/wizardry/spell/FrostRay.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivin
(int)(getProperty(EFFECT_DURATION).floatValue() * modifiers.get(WizardryItems.duration_upgrade)),
getProperty(EFFECT_STRENGTH).intValue()));

if(ticksInUse % ((EntityLivingBase)target).maxHurtResistantTime == 1){
if(ticksInUse % 10 == 0){
float damage = getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY);
if(target instanceof EntityBlaze || target instanceof EntityMagmaCube) damage *= 2;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/electroblob/wizardry/spell/LifeDrain.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivin

if(EntityUtils.isLiving(target)){

if(ticksInUse % 12 == 0){
if(ticksInUse % 10 == 0){

float damage = getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/electroblob/wizardry/spell/LightningRay.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivin
this.getNameForTranslationFormatted()), true);
// This now only damages in line with the maxHurtResistantTime. Some mods don't play nicely and fiddle
// with this mechanic for their own purposes, so this line makes sure that doesn't affect wizardry.
}else if(ticksInUse % ((EntityLivingBase)target).maxHurtResistantTime == 1){
}else if(ticksInUse % 10 == 0){
EntityUtils.attackEntityWithoutKnockback(target,
MagicDamage.causeDirectMagicDamage(caster, DamageType.SHOCK),
getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/electroblob/wizardry/spell/LightningWeb.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected void playSound(World world, double x, double y, double z, int ticksInU
@Override
protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){

if(EntityUtils.isLiving(target)){
if(EntityUtils.isLiving(target) && ticksInUse % 10 == 0){

electrocute(world, caster, origin, target, getProperty(PRIMARY_DAMAGE).floatValue()
* modifiers.get(SpellModifiers.POTENCY), ticksInUse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivin
if(!world.isRemote && ticksInUse == 1 && caster instanceof EntityPlayer) ((EntityPlayer)caster)
.sendStatusMessage(new TextComponentTranslation("spell.resist", target.getName(),
this.getNameForTranslationFormatted()), true);
}else{
}else if (ticksInUse % 10 == 0) {

float damage = getProperty(DAMAGE).floatValue() * modifiers.get(SpellModifiers.POTENCY);
// Fire
Expand Down

0 comments on commit 112a562

Please sign in to comment.