コード例 #1
0
ファイル: effects.cpp プロジェクト: jcon321/Server
int32 Client::GetActDoTDamage(uint16 spell_id, int32 value, Mob* target) {

    if (target == nullptr)
        return value;

    int32 value_BaseEffect = 0;
    int32 extra_dmg = 0;
    int16 chance = 0;
    chance += itembonuses.CriticalDoTChance + spellbonuses.CriticalDoTChance + aabonuses.CriticalDoTChance;

    if (spellbonuses.CriticalDotDecay)
        chance += GetDecayEffectValue(spell_id, SE_CriticalDotDecay);

    value_BaseEffect = value + (value*GetFocusEffect(focusFcBaseEffects, spell_id)/100);

    if (chance > 0 && (zone->random.Roll(chance))) {
        int32 ratio = 200;
        ratio += itembonuses.DotCritDmgIncrease + spellbonuses.DotCritDmgIncrease + aabonuses.DotCritDmgIncrease;
        value = value_BaseEffect*ratio/100;
        value += int(value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100)*ratio/100;
        value += int(value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100)*ratio/100;
        value += int(value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100)*ratio/100;
        extra_dmg = target->GetFcDamageAmtIncoming(this, spell_id) +
                    int(GetFocusEffect(focusFcDamageAmtCrit, spell_id)*ratio/100) +
                    GetFocusEffect(focusFcDamageAmt, spell_id);

        if (extra_dmg) {
            int duration = CalcBuffDuration(this, this, spell_id);
            if (duration > 0)
                extra_dmg /= duration;
        }

        value -= extra_dmg;

        return value;
    }

    value = value_BaseEffect;
    value += value_BaseEffect*GetFocusEffect(focusImprovedDamage, spell_id)/100;
    value += value_BaseEffect*GetFocusEffect(focusFcDamagePctCrit, spell_id)/100;
    value += value_BaseEffect*target->GetVulnerability(this, spell_id, 0)/100;
    extra_dmg = target->GetFcDamageAmtIncoming(this, spell_id) +
                GetFocusEffect(focusFcDamageAmtCrit, spell_id) +
                GetFocusEffect(focusFcDamageAmt, spell_id);

    if (extra_dmg) {
        int duration = CalcBuffDuration(this, this, spell_id);
        if (duration > 0)
            extra_dmg /= duration;
    }

    value -= extra_dmg;

    return value;
}
コード例 #2
0
ファイル: effects.cpp プロジェクト: gpanula/Server
int32 Mob::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {

	if (target == nullptr)
		target = this;

	if (IsNPC())
		value += value*CastToNPC()->GetSpellFocusHeal()/100;

	int32 value_BaseEffect = 0;
	int16 chance = 0;
	int8 modifier = 1;
	bool Critical = false;

	value_BaseEffect = value + (value*GetFocusEffect(focusFcBaseEffects, spell_id)/100);

	value = value_BaseEffect;

	value += int(value_BaseEffect*GetFocusEffect(focusImprovedHeal, spell_id)/100);

	// Instant Heals
	if(spells[spell_id].buffduration < 1) {

		chance += itembonuses.CriticalHealChance + spellbonuses.CriticalHealChance + aabonuses.CriticalHealChance;

		chance += target->GetFocusIncoming(focusFcHealPctCritIncoming, SE_FcHealPctCritIncoming, this, spell_id);

		if (spellbonuses.CriticalHealDecay)
			chance += GetDecayEffectValue(spell_id, SE_CriticalHealDecay);

		if(chance && (zone->random.Roll(chance))) {
			Critical = true;
			modifier = 2; //At present time no critical heal amount modifier SPA exists.
		}

		value *= modifier;
		value += GetFocusEffect(focusFcHealAmtCrit, spell_id) * modifier;
		value += GetFocusEffect(focusFcHealAmt, spell_id);
		value += target->GetFocusIncoming(focusFcHealAmtIncoming, SE_FcHealAmtIncoming, this, spell_id);

		if(itembonuses.HealAmt && spells[spell_id].classes[(GetClass()%16) - 1] >= GetLevel() - 5)
			value += GetExtraSpellAmt(spell_id, itembonuses.HealAmt, value) * modifier;

		value += value*target->GetHealRate(spell_id, this)/100;

		if (IsNPC() && CastToNPC()->GetHealScale())
			value = int(static_cast<float>(value) * CastToNPC()->GetHealScale() / 100.0f);

		if (Critical) {
			entity_list.MessageClose_StringID(this, true, 100, MT_SpellCrits,
					OTHER_CRIT_HEAL, GetName(), itoa(value));

			if (IsClient())
				Message_StringID(MT_SpellCrits, YOU_CRIT_HEAL, itoa(value));
		}

		return value;
	}

	//Heal over time spells. [Heal Rate and Additional Healing effects do not increase this value]
	else {

		chance = itembonuses.CriticalHealOverTime + spellbonuses.CriticalHealOverTime + aabonuses.CriticalHealOverTime;

		chance += target->GetFocusIncoming(focusFcHealPctCritIncoming, SE_FcHealPctCritIncoming, this, spell_id);

		if (spellbonuses.CriticalRegenDecay)
			chance += GetDecayEffectValue(spell_id, SE_CriticalRegenDecay);

		if(chance && zone->random.Roll(chance))
			value *= 2;
	}

	if (IsNPC() && CastToNPC()->GetHealScale())
		value = int(static_cast<float>(value) * CastToNPC()->GetHealScale() / 100.0f);

	return value;
}