All pastes #36435 Raw Edit

Something

public text v1 · immutable
#36435 ·published 2006-01-11 02:45 UTC
rendered paste body
    private int[] calculateExpAndSp(int diff, int damage)
    {
        double xp = 0;
        double sp = 0;
        
        // For the Config Alt Game Exponents and not
        if (Config.ALT_GAME_EXPONENT_XP != 0)
        {
        	xp = (double)getExpReward() * damage / getMaxHp();
        }
        else
        {
        	xp = (double)getExpReward() * damage / getMaxHp();
        }
        
        if (Config.ALT_GAME_EXPONENT_SP != 0)
        {
        	sp = (double)getSpReward() * damage / getMaxHp();
        }
        else
        {
        	sp = (double)getSpReward() * damage / getMaxHp();
        }
        
        // the differences
        if (diff > 5)
        {
        	xp = xp - diff * xp / 10;
        	sp = sp - diff * sp / 10;
        }
        else if (diff > 8)
        {
        	xp = 0;
        	sp = 0;
        }
        
        
        // If xp or sp is zero
        if (xp <= 0)
        {
        	xp = 0;
        	sp = 0;
        }
        else if (sp <= 0 && xp > 0)
        {
            sp = 0;
        }
        
        int[] tmp = { (int)xp, (int)sp };
        
        return  tmp;
    }