• Welcome to Freedom Reborn Archive.
 

Absorb PD tinkering

Started by Panther_Gunn, November 28, 2007, 06:43:58 PM

Previous topic - Next topic

Panther_Gunn

Is there an attribute, or is it possible to create one, so that the Absorb Passive Defence will add to hit points, once Energy is full?  I've been playing with Hulk a little lately, against the Dominion, and it occurred to me that all that radiation might actually heal him, once his tanks got charged back up.  Am I completely into "wish" territory with this one?

stumpy

Not necessarily completely. Something like the code TaskMasterX uses to create FF1-style active defenses might be rigged to do what you suggest. I don't have time to try it out now, but it is a possibility.

In the meanwhile, something that would be easy to do and have a similar effect (though not exactly the same) would be to create a modified REGENERATION attribute that only heals the character when he has over a certain fraction of his total energy (say half) and combine that with ENERGY TANKS. For a character like The Hulk, if his only absorb defense is against radiation, then you are set, because that is the only thing (excepting energy canisters, energy transfer powers, etc.) that will get him over 50% energy points.

This is the code for an ENERGY HEALER attribute (FFEdit name: energyhealer) and LESSER ENERGY HEALER attribute (FFEdit name: lesserenergyhealer) that only kick in when the character is at over 50% of his energy. This is totally ripped off from the superhealer code and it's untested since I can't start the game right now, but it should be pretty close.

############ ENERGYHEALER ###########################################

#Ep. 2007-03-24:
# - Updated to use the same code base for Superhealer ("Regenerative") and Lesser Regeneration.
# - Replaced RegTimer() by RegDamage() when not damaged.
# - Fixed an issue where character would get more than maxHealth
# - Nerfed by reducing healing frequency from every 1.0 sec. to every 1.5 sec.
# - stumpy 2007-11-28: slight variation that does no healing unless character is at over
#   50% of maxEP, then heals at full speed. See http://freedomreborn.net/archive/index.php?topic=45365.

# strings.txt lines
##attrib_energyhealer_01, energy healer
##attrib_energyhealer_desc_01, you heal at an amazing rate, but only when you have more than half of your energy points

def initenergyhealer(char,update=0,remove=0):
    if remove:
        FFX_ObjectSetAttr(char,'energyhealer',0)
    else:
        FFX_ObjectSetAttr(char,'energyhealer',1)
    if update==0:
        RegDamage(char, 'updateenergyhealer', user = 8, persistent = 0, string = '')

def updateenergyhealer(event):
    SuperHealerRatio=2  #cost in EP for each health point healed
    char=event.object
    healingSpeed=int(event.user) #The difference between Superhealer and LesserRegeneration
    if not Object_Exists(char):
        return
    if (not hasAttribute(char,'energyhealer')) and (not hasAttribute(char,'lesserenergyhealer')):
        return
    if not Object_IsAlive(char):
        RegTimer('updateenergyhealer', 1.5, healingSpeed, char)
        return
    health=Object_GetAttr(char,'health')
    maxHealth=Object_GetAttr(char,'maxHealth')
    if health >= maxHealth:
        RegDamage(char, 'updateenergyhealer', user = healingSpeed, persistent = 0, string = '')
        return
    RegTimer('updateenergyhealer', 1.5, healingSpeed, char)
    maxEP = Object_GetAttr(char,'maxEnergyPoints')
    EP = Object_GetAttr(char,'energyPoints')
    if maxEP > 0:
        percentage=EP/maxEP
    else:
        percentage=0
    if percentage > 0.5:
        healing=int(healingSpeed)
        if healing>(EP/SuperHealerRatio):
            healing=int(EP/SuperHealerRatio)
        if health + healing > maxHealth:
            healing = maxHealth - health
            if healing<0:
                healing=0
                health=maxHealth
        Object_SetAttr(char,'health',health+healing)
        Object_SetAttr(char,'energyPoints',EP-healing*SuperHealerRatio)

#################### Lesser Energy Regeneration #################################
#Ep. 2007-03-24: replaced updatefasthealer() code with call to modified updatesuperhealer()
# - stumpy 2007-11-28: same idea as above, but for the slower-healing version.
#   See http://freedomreborn.net/archive/index.php?topic=45365.
       
# strings.txt lines
##attrib_lesserenergyhealer_01, lesser energy healer
##attrib_lesserenergyhealer_desc_01, you heal pretty fast, but only when you aren't tired

def initlesserenergyhealer(char,update=0,remove=0):
    if remove:
        FFX_ObjectSetAttr(char,'lesserenergyhealer',0)
    else:
        FFX_ObjectSetAttr(char,'lesserenergyhealer',1)
    if update==0:
        RegDamage(char, 'updateenergyhealer', user = 1, persistent = 0, string = '')


Try it out and see if it works.