Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // COMBAT.CPP
- ReturnValue Combat::canDoCombat(const Creature* attacker, const Creature* target, bool isAggressive)
- {
- if(!attacker)
- return RET_NOERROR;
- // Verifica si el combate está deshabilitado para el atacante
- if (attacker->isCombatDisabled()) {
- return RET_NOTPOSSIBLE;
- }
- // Resto de la lógica....
- }
- // CREATURE.H
- class Creature : public AutoId, virtual public Thing
- {
- protected:
- Creature();
- public:
- bool isCombatDisabled() const;
- };
- // CREATURE.CPP
- bool Creature::isCombatDisabled() const
- {
- return hasCondition(CONDITION_COMBAT_DISABLE);
- }
- // CONDITION.H
- enum ConditionType_t
- {
- CONDITION_LOGINPROTECTION = 1 << 25,
- CONDITION_COMBAT_DISABLE = 1 << 26
- };
- // 050-FUNCTION.LUA
- function isCombatDisabled(creatureId)
- return hasCondition(creatureId, CONDITION_COMBAT_DISABLE)
- end
- // GAMAKICHI_FOLLOW.LUA
- function onThink(creatureId)
- if not isCreature(creatureId) then
- return true
- end
- if isCombatDisabled(creatureId) then
- -- Si el combate está deshabilitado, simplemente detenemos cualquier ataque en curso
- local target = getCreatureTarget(creatureId)
- if target ~= 0 then
- doRemoveCondition(creatureId, CONDITION_INFIGHT)
- end
- return true
- end
- local master = getCreatureMaster(creatureId)
- if master and isPlayer(master) then
- end
- return true
- end
- // MONSTER.XML
- <script>
- <event name="GamakichiThink"/>
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement