Skip to content

Commit

Permalink
fix: effect potions
Browse files Browse the repository at this point in the history
  • Loading branch information
Veradictus committed Sep 28, 2023
1 parent 4551f11 commit 35865db
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 7 deletions.
36 changes: 32 additions & 4 deletions packages/server/data/plugins/items/effectpotion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,47 @@ export default class EffectPotion implements Plugin {
private getEffect(): Modules.Effects {
switch (this.effect) {
case 'accuracy': {
return Modules.Effects.AccuracyPotion;
return Modules.Effects.AccuracyBuff;
}

case 'strength': {
return Modules.Effects.StrengthPotion;
return Modules.Effects.StrengthBuff;
}

case 'defense': {
return Modules.Effects.DefensePotion;
return Modules.Effects.DefenseBuff;
}

case 'magic': {
return Modules.Effects.MagicBuff;
}

case 'archery': {
return Modules.Effects.ArcheryBuff;
}

case 'accuracysuper': {
return Modules.Effects.AccuracySuperBuff;
}

case 'strengthsuper': {
return Modules.Effects.StrengthSuperBuff;
}

case 'defensesuper': {
return Modules.Effects.DefenseSuperBuff;
}

case 'magicsuper': {
return Modules.Effects.MagicSuperBuff;
}

case 'archerysuper': {
return Modules.Effects.ArcherySuperBuff;
}

default: {
return Modules.Effects.StrengthPotion;
return Modules.Effects.StrengthBuff;
}
}
}
Expand Down
11 changes: 8 additions & 3 deletions packages/server/src/info/formulas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ export default {
}

// Increase accuracy if the attacker has the accuracy potion effect.
if (attacker.status.has(Modules.Effects.AccuracyPotion)) accuracy -= 0.07;
if (attacker.status.has(Modules.Effects.AccuracyBuff)) accuracy -= 0.07;
if (attacker.status.has(Modules.Effects.AccuracySuperBuff)) accuracy -= 0.12;

// Decrease accuracy if the target has the defense potion effect.
if (target.status.has(Modules.Effects.DefensePotion)) accuracy += 0.08;
if (target.status.has(Modules.Effects.DefenseBuff)) accuracy += 0.08;
if (target.status.has(Modules.Effects.DefenseSuperBuff)) accuracy += 0.12;

// Increase accuracy if the target has the terror effect.
if (target.status.has(Modules.Effects.Terror)) accuracy -= 0.4;
Expand Down Expand Up @@ -186,7 +188,10 @@ export default {
}

// Apply a 10% damage boost if the character has the strength potion effect.
if (character.status.has(Modules.Effects.StrengthPotion)) damage *= 1.1;
if (character.status.has(Modules.Effects.StrengthBuff)) damage *= 1.1;

// Apply 15% damage boost if the character has the super strength potion effect.
if (character.status.has(Modules.Effects.StrengthSuperBuff)) damage *= 1.15;

// Ensure the damage is not negative.
if (damage < 0) damage = 0;
Expand Down

0 comments on commit 35865db

Please sign in to comment.