From e28d6b2d8aa65cc5629a1662cd14d72672e2fa1f Mon Sep 17 00:00:00 2001 From: bororeh Date: Fri, 17 May 2024 15:34:13 -0300 Subject: [PATCH 1/2] Poisoning --- events/e_poisoning.scp | 325 +++++++++++++++++++++++++++++++++++++++++ items/i_animations.scp | 4 + 2 files changed, 329 insertions(+) create mode 100644 events/e_poisoning.scp diff --git a/events/e_poisoning.scp b/events/e_poisoning.scp new file mode 100644 index 0000000..6bd7df3 --- /dev/null +++ b/events/e_poisoning.scp @@ -0,0 +1,325 @@ +// Combat poisoning by MalucoBeleza. +// +// This script was meant to maintain as much as the original scriptpack as possible. +// Poisoning skill was not altered. Poison potions add the following moreZ values to blades: +// Lesser poison: moreZ = 40 +// Poison: moreZ = 50 +// Greater poison: moreZ = 90 +// Deadly poison: moreZ = 105 +// +// Potions: +// Lesser cure potions cure only lesser poison. +// Cure potions cure lesser poison and poison. +// Greater cure potions cure all poisons. +// If you drink a potion that cannot cure your poison, it lowers the poison level by 1 (deadly poison goes to greater poison, greater poison goes to poison and poison goes to lesser poison). +// +// Cure spells: +// Cure spell cures lesser poison, poison and greater poison. If you are deadly poisoned, the poison is lowered to greater poison. +// Arch cure spell cures all poisons. +// +// Poison spells: +// If you were poisoned by a weapon and receives a poison spell, the spell overrides the combat poison (same with poison field). + +[defname poisoningDefs] +poisonAppliedBy 1 // 0: by chance; 1: by a number of hits + +chancePoisonLesser 40 +chancePoisonRegular 30 +chancePoisonGreater 20 +chancePoisonDeadly 10 + +hitsPoisonLesser 3 +hitsPoisonRegular 4 +hitsPoisonGreater 5 +hitsPoisonDeadly 6 + +hitsPoisonDecay 3 // seconds for hits to decay + +timerPoisonLesser 5 +timerPoisonRegular 4 +timerPoisonGreater 4 +timerPoisonDeadly 3 + +ticksPoisonLesser 3 +ticksPoisonRegular 4 +ticksPoisonGreater 5 +ticksPoisonDeadly 6 + +poisonDmgType 1 // 0: by a percentual of the victim's hitpoints (the next 4 defs should be integers) + // 1: by a fixed amount (the next 4 defs should be min,max) + +dmgPoisonLesser 7,9 +dmgPoisonRegular 10,12 +dmgPoisonGreater 15,17 +dmgPoisonDeadly 19,21 + +[EVENTS e_poisoning] +On=@Hit + if () + if ( > 0) && !( & statf_poisoned) && !() + if ( == 0) + if ( == 40) + local.poisonChance = + + elif ( == 50) + local.poisonChance = + + elif ( == 90) + local.poisonChance = + + elif ( == 105) + local.poisonChance = + + endif + + local.random = + if ( > ) + serv.newitem i_memPoisoned + new.link = + new.moreZ = + src.equip + endif + + elif ( == 1) + if !() + serv.newitem i_memPoisonHits + src.equip + + endif + src.findid.i_memPoisonHits.tag0. ++ + src.findid.i_memPoisonHits.trigger @SetTimer + + if ( == 40) && (> >= ) + src.findid.i_memPoisonHits.remove + serv.newitem i_memPoisoned + new.link = + new.moreZ = + src.equip + + elif ( == 50) && (> >= ) + src.findid.i_memPoisonHits.remove + serv.newitem i_memPoisoned + new.link = + new.moreZ = + src.equip + + elif ( == 90) && (> >= ) + src.findid.i_memPoisonHits.remove + serv.newitem i_memPoisoned + new.link = + new.moreZ = + src.equip + + elif ( == 105) && (> >= ) + src.findid.i_memPoisonHits.remove + serv.newitem i_memPoisoned + new.link = + new.moreZ = + src.equip + + endif + endif + endif + endif + +[ITEMDEF i_memPoisonHits] +ID=i_potion_poison +NAME=poisonMemHits +WEIGHT=0 +LAYER=layer_special +TYPE=t_eq_script +On=@Create + attr = attr_invis|attr_newbie + timer = + +On=@Timer + for 0 - 1> + tag..key> -- + if (.key>> <= 0) + tag..key> = + else + local.noRemove = 1 + endif + endfor + + if ( == 1) + trigger @SetTimer + + else + remove + + endif + + return 1 + +On=@SetTimer + timer = + +[ITEMDEF i_memPoisoned] +ID=i_potion_poison +NAME=poisonMem +WEIGHT=0 +LAYER=layer_special +TYPE=t_eq_script +On=@Create + attr = attr_invis|attr_newbie + +On=@Equip + if !( & statf_poisoned) + src.flags |= statf_poisoned + endif + + src.events +e_poisoned + + src.sound snd_spell_poison + src.effect 3,i_fx_curse,1,16,0 + + src.sysmessageua 70,1,1,1, You have been poisoned by ! + src.emote has been poisoned! + + if ( == 40) + timer = + tag.ticks = + + elif ( == 50) + timer = + tag.ticks = + + elif ( == 90) + timer = + tag.ticks = + + elif ( == 105) + timer = + tag.ticks = + + endif + +On=@Timer + if ( == 40) + timer = + local.dmg = + + elif ( == 50) + timer = + local.dmg = + + elif ( == 90) + timer = + local.dmg = + + elif ( == 105) + timer = + local.dmg = + + endif + + if ( == 0) + local.dmg = *)/100> + endif + cont.damage >, dam_poison, + + tag0.tick += 1 + if ( >= ) + remove + endif + + return 1 + +On=@UnEquip + if ( & statf_poisoned) + src.flags &=~ statf_poisoned + endif + + src.events -e_poisoned + + if ( == 0) + src.sysmessageua 70,1,1,1, You feel better! + endif + +[EVENTS e_poisoned] +On=@SpellEffect + if ( == 11) // cure (potion or spell) + if () + + if () && ( == t_potion) + if ( >= 1000) // greater cure potion + findid.i_memPoisoned.remove + + elif ( >= 600) // cure potion + if ( == 40) || ( == 50) + findid.i_memPoisoned.remove + + elif ( == 90) + sysmessageua 70,1,1,1, The spell wasn't strong enough to cure your poison, but it still helped. + findid.i_memPoisoned.moreZ = 50 + findid.i_memPoisoned.trigger @SetTimer + + elif ( == 105) + sysmessageua 70,1,1,1, The spell wasn't strong enough to cure your poison, but it still helped. + findid.i_memPoisoned.moreZ = 90 + findid.i_memPoisoned.trigger @SetTimer + + endif + + elif ( >= 400) // lesser cure potion + if ( == 40) + findid.i_memPoisoned.remove + + elif ( == 50) + sysmessageua 70,1,1,1, The spell wasn't strong enough to cure your poison, but it still helped. + findid.i_memPoisoned.moreZ = 40 + findid.i_memPoisoned.trigger @SetTimer + + elif ( == 90) + sysmessageua 70,1,1,1, The spell wasn't strong enough to cure your poison, but it still helped. + findid.i_memPoisoned.moreZ = 50 + findid.i_memPoisoned.trigger @SetTimer + + elif ( == 105) + sysmessageua 70,1,1,1, The spell wasn't strong enough to cure your poison, but it still helped. + findid.i_memPoisoned.moreZ = 90 + findid.i_memPoisoned.trigger @SetTimer + + endif + endif + + else // spell + if ( < 105) + findid.i_memPoisoned.remove + + else + sysmessageua 70,1,1,1, The spell wasn't strong enough to cure your poison, but it still helped. + findid.i_memPoisoned.moreZ = 90 + + endif + endif + endif + + elif ( == 20) || ( == 39) // poison + if () + findid.i_memPoisoned.tag.noWarning = 1 + findid.i_memPoisoned.remove + endif + + if () + findid.i_memPoisonHits.remove + endif + + elif ( == 25) // arch cure + if () + findid.i_memPoisoned.remove + endif + endif + +[FUNCTION f_checkPoisoned] +if () + src.findid.i_memPoisoned.tag.noWarning = 1 + src.findid.i_memPoisoned.remove +endif + +if () + src.findid.i_memPoisonHits.remove +endif + +[EOF] diff --git a/items/i_animations.scp b/items/i_animations.scp index e01d863..4fe7207 100644 --- a/items/i_animations.scp +++ b/items/i_animations.scp @@ -2217,6 +2217,8 @@ CATEGORY=Animations SUBSECTION=Poison Fields DESCRIPTION=Poison Field West/East DUPELIST=03916,03917,03918,03919,0391a,0391b,0391c,0391d,0391e,0391f +On=@Step + f_checkPoisoned [ITEMDEF 03916] //Poison Field West/East (animation frame) @@ -2269,6 +2271,8 @@ CATEGORY=Animations SUBSECTION=Poison Fields DESCRIPTION=Poison Field North/South DUPELIST=03920,03922,03923,03924,03925,03926,03927,03928,03929 +On=@Step + f_checkPoisoned [ITEMDEF 03922] //Poison Field North/South (animation frame) From 41382277bb4edec6e91a9615168f2f2f78110da2 Mon Sep 17 00:00:00 2001 From: bororeh Date: Fri, 17 May 2024 15:40:22 -0300 Subject: [PATCH 2/2] Poisoning --- skills/skillclasses.scp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/skills/skillclasses.scp b/skills/skillclasses.scp index 1f4b0aa..9c11a56 100644 --- a/skills/skillclasses.scp +++ b/skills/skillclasses.scp @@ -74,17 +74,19 @@ Mysticism=100.0 Imbuing=100.0 Throwing=100.0 - ON=@ItemEquip -if (==t_armor && !) - tag0.MeditPenalty ++ - f_meditation_setup -endif + if (==t_armor && !) + tag0.MeditPenalty ++ + f_meditation_setup + endif ON=@ItemUnEquip -if (==t_armor && !) - tag0.MeditPenalty -- - f_meditation_setup -endif + if (==t_armor && !) + tag0.MeditPenalty -- + f_meditation_setup + endif +On=@LogIn + events +e_poisoning + [EOF] \ No newline at end of file