Jump to content
  • 0

Elemental Resistance Cap


Question

Posted

I needed code to put a Cap on Elemental resists. I want to cap them at 40.

 

What ive got so far done in CharStat.java is only visual in game, it does not really put a cap, only looks like it. I need help making code to actually cap it, I guess where formulas are done.

 

Heres what I got so far done in CharStat.java that is only visual:

 

/**ReturntheElementalAttributeCapForFire*/
publicdouble getElementAttributeFire()
{
if (_activeChar == null)
return 1;

int val = (int) (100 - 100 * calcStat(Stats.FIRE_VULN, _activeChar.getTemplate().baseFireVuln, null, null));
if (val > Config.MAX_STAT && !_activeChar.isGM())
val = Config.MAX_STAT;
return val;
}


/**ReturntheElementalAttributeCapForWater*/
publicdouble getElementAttributeWater()
{
if (_activeChar == null)
return 1;

int val = (int) (100 - 100 * calcStat(Stats.WATER_VULN, _activeChar.getTemplate().baseWaterVuln, null, null));
if (val > Config.MAX_STAT && !_activeChar.isGM())
val = Config.MAX_STAT;
return val;
}


/**ReturntheElementalAttributeCapForEarth*/
publicdouble getElementAttributeEarth()
{
if (_activeChar == null)
return 1;

int val = (int) (100 - 100 * calcStat(Stats.EARTH_VULN, _activeChar.getTemplate().baseEarthVuln, null, null));
if (val > Config.MAX_STAT && !_activeChar.isGM())
val = Config.MAX_STAT;
return val;
}

/**ReturntheElementalAttributeCapForWind*/
publicdouble getElementAttributeWind()
{
if (_activeChar == null)
return 1;

int val = (int) (100 - 100 * calcStat(Stats.WIND_VULN, _activeChar.getTemplate().baseWindVuln, null, null));
if (val > Config.MAX_STAT && !_activeChar.isGM())
val = Config.MAX_STAT;
return val;
}

/**ReturntheElementalAttributeCapForHoly*/
publicdouble getElementAttributeHoly()
{
if (_activeChar == null)
return 1;

int val = (int) (100 - 100 * calcStat(Stats.HOLY_VULN, _activeChar.getTemplate().baseHolyVuln, null, null));
if (val > Config.MAX_STAT && !_activeChar.isGM())
val = Config.MAX_STAT;
return val;
}

/**ReturntheElementalAttributeCapForUnHoly*/
publicdouble getElementAttributeUnholy()
{
if (_activeChar == null)
return 1;

int val = (int) (100 - 100 * calcStat(Stats.DARK_VULN, _activeChar.getTemplate().baseDarkVuln, null, null));
if (val > Config.MAX_STAT && !_activeChar.isGM())
val = Config.MAX_STAT;
return val;
}
}

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...