Sphereserver / Source-X

Ultima Online server emulator
Apache License 2.0
57 stars 45 forks source link

[Feature Request] Let us adjust the poison level to decrease. #1159

Closed canerksk closed 2 weeks ago

canerksk commented 11 months ago

This incident has always been a bleeding wound in the sphere. I put deadly poison on my weapon and with one hit the poison level (morez) would either drop to very ill or sickly. I think we should be able to adjust the amount of poison level that will drop ourselves.

eg;


    Args.m_VarsLocal.SetNum("ItemDamageChance", 25);

    if (pWeapon)
    {
        if (pWeapon->m_itWeapon.m_poison_skill && Calc_GetRandVal(100) < pWeapon->m_itWeapon.m_poison_skill)
        {
            iPoisonDeliver = (byte)(Calc_GetRandVal(pWeapon->m_itWeapon.m_poison_skill));
            Args.m_VarsLocal.SetNum("ReduceWeaponPoisonCharges", iPoisonDeliver);
        }
    }
..
..
..
// Hit noise (based on weapon type)

if ( pWeapon )
{
    // Check if the weapon is poisoned
    //if ( !IsSetCombatFlags(COMBAT_NOPOISONHIT) && pWeapon->m_itWeapon.m_poison_skill && (pWeapon->m_itWeapon.m_poison_skill > Calc_GetRandVal(100) || pWeapon->m_itWeapon.m_poison_skill < 10))
    if (iPoisonDeliver)
    {
        //byte iPoisonDeliver = (byte)(Calc_GetRandVal(pWeapon->m_itWeapon.m_poison_skill));

        byte ReduceWeaponPoisonCharges = (byte)(Args.m_VarsLocal.GetKeyNum("ReduceWeaponPoisonCharges") / 2);

        //pCharTarg->SetPoison(10 * iPoisonDeliver, iPoisonDeliver / 5, this);

        pCharTarg->SetPoisonOld(10 * iPoisonDeliver, iPoisonDeliver / 5, this);

        //pWeapon->m_itWeapon.m_poison_skill -= iPoisonDeliver / 2; // reduce weapon poison charges
        //pWeapon->m_itWeapon.m_poison_skill -= iPoisonDeliver / 4; // reduce weapon poison charges

        pWeapon->m_itWeapon.m_poison_skill -= ReduceWeaponPoisonCharges;    // reduce weapon poison charges

        pWeapon->UpdatePropertyFlag();

        //if (IsPriv(PRIV_DETAIL))
            //SysMessagef("Reduce Weapon Poison Charges: %i", ReduceWeaponPoisonCharges);

    }
..
..
..

under @Hit trigger

eg;

on=@HIT
local.ReduceWeaponPoisonCharges=<r0,2>

The codes here are purely examples. Although many have been tested, some may need to be rewritten.

drk84 commented 11 months ago

You can control poison behaviour with SpellEffectTick trigger https://wiki.spherecommunity.net/index.php?title=@SpellEffectTick

Additional notes:

These triggers fires on the following spells and any custom spells with the SPELLFLAG_TICK:
        Poison: You can now change the damage and damage type by changing the local.effect and local.damage value in these triggers.
        Strangle and Pain Spike: You can now change the damage and damage type in these triggers.
        Regeneration: A Sphere custom spell, you can change the healing value by changing the local.effect value.
        Hallucination: A Sphere custom spell, you can change the duration of the hangover by using local.charges and local.delay.
        Alchool: Unlike in real life, you can change the duration of the hangover by using local.charges and local.delay.
        Custom Spells: Simply add SPELLFLAG_TICK to the spell spellflags. By default every spell memory starts with one charge.
            Spells with SPELLFLAG_HARM and local.damagetype set will cause damage every local.delay seconds.
            Spells with SPELLFLAG_HEAL will heal hitpoints every local.delay seconds.
            Remember that is not mandatory to use  SPELLFLAG_SCRIPTED to make a custom spell, you can just use a spell id higher than 1055, usually i choose 2000. 
canerksk commented 11 months ago

What is mentioned here is not the poison that hits the person, but the morez value remaining on the weapon. It is the number of morez that will decrease with each hit.

xwerswoodx commented 11 months ago

Technically if you want to customize poison level on every hit, you can just check if player has poison, and just do -morez for it, we really don't need to add local for this at all.

On=@Hit
IF (<FINDID.i_rune_poison>)
  FINDID.i_rune_poison.MOREZ -= <R2>
ENDIF
canerksk commented 11 months ago

When I hit a player with a sold weapon, I don't want to check the poison on the player, I want to check the remaining level in the weapon morez of the attacker.

pWeapon->m_itWeapon.m_poison_skill -= ReduceWeaponPoisonCharges;

Weapon m_poison_skill = weapon morez level

In other words, I want to adjust how much the poison level of that weapon will decrease when someone is shot with the weapon sold.

cbnolok commented 2 weeks ago

Closing as addressed.