Ejemplo n.º 1
0
void Combat::doCombatMana(Creature* caster, Creature* target,
                          const int32_t& minChange, const int32_t& maxChange, const CombatParams& params)
{
	if (!params.isAggressive || (caster != target && Combat::canDoCombat(caster, target) == RET_NOERROR))
	{
		Combat2Var var;
		var.minChange = minChange;
		var.maxChange = maxChange;
		CombatManaFunc(caster, target, params, (void*)&var);

		if (params.targetCallback)
		{
			params.targetCallback->onTargetCombat(caster, target);
		}

		if (params.impactEffect != NM_ME_NONE)
		{
			g_game.addMagicEffect(target->getPosition(), params.impactEffect);
		}

		if (caster && params.distanceEffect != NM_ME_NONE)
		{
			addDistanceEffect(caster, caster->getPosition(), target->getPosition(), params.distanceEffect);
		}
	}
}
Ejemplo n.º 2
0
void Combat::doCombatMana(Creature* caster, Creature* target, CombatDamage& damage, const CombatParams& params)
{
	bool canCombat = !params.isAggressive || (caster != target && Combat::canDoCombat(caster, target) == RET_NOERROR);
	if ((caster == target || canCombat) && params.impactEffect != CONST_ME_NONE) {
		g_game.addMagicEffect(target->getPosition(), params.impactEffect);
	}

	if (canCombat) {
		CombatManaFunc(caster, target, params, &damage);
		if (params.targetCallback) {
			params.targetCallback->onTargetCombat(caster, target);
		}

		if (caster && params.distanceEffect != CONST_ANI_NONE) {
			addDistanceEffect(caster, caster->getPosition(), target->getPosition(), params.distanceEffect);
		}
	}
}
Ejemplo n.º 3
0
void Combat::doCombatMana(const CreatureP& caster, const CreatureP& target, int32_t minChange, int32_t maxChange, const CombatParams& params)
{
	if(params.isAggressive && (caster == target || Combat::canDoCombat(caster, target) != RET_NOERROR))
		return;

	Combat2Var var;
	var.minChange = minChange;
	var.maxChange = maxChange;

	CombatManaFunc(caster, target, params, (void*)&var);
	if(params.targetCallback)
		params.targetCallback->onTargetCombat(caster, target);

	if(params.effects.impact != MAGIC_EFFECT_NONE && (!caster || !caster->isGhost()
		|| server.configManager().getBool(ConfigManager::GHOST_SPELL_EFFECTS)))
		server.game().addMagicEffect(target->getPosition(), params.effects.impact);

	if(caster && params.effects.distance != SHOOT_EFFECT_NONE)
		addDistanceEffect(caster, caster->getPosition(), target->getPosition(), params.effects.distance);
}