From cec65058123f710643290c13b7f2b0512b878381 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Sat, 27 Apr 2013 21:09:23 +0200 Subject: [Abilities] Removed the old autoattack system As a side effect i had to remove the monster attack AI for now. I will readd this as next thing. --- src/CMakeLists.txt | 6 - src/common/manaserv_protocol.h | 17 -- src/game-server/actor.h | 15 +- src/game-server/attack.cpp | 141 --------- src/game-server/attack.h | 213 -------------- src/game-server/being.cpp | 5 +- src/game-server/being.h | 3 +- src/game-server/character.cpp | 55 ---- src/game-server/character.h | 7 - src/game-server/combatcomponent.cpp | 226 --------------- src/game-server/combatcomponent.h | 118 -------- src/game-server/gamehandler.cpp | 23 +- src/game-server/gamehandler.h | 1 - src/game-server/item.cpp | 28 -- src/game-server/item.h | 23 -- src/game-server/itemmanager.cpp | 6 - src/game-server/mapcomposite.cpp | 8 - src/game-server/monster.cpp | 250 ---------------- src/game-server/monster.h | 55 ---- src/game-server/monstercombatcomponent.cpp | 95 ------ src/game-server/monstercombatcomponent.h | 54 ---- src/game-server/monstermanager.cpp | 39 --- src/game-server/state.cpp | 14 - src/scripting/lua.cpp | 446 +---------------------------- src/scripting/luautil.h | 8 - 25 files changed, 15 insertions(+), 1841 deletions(-) delete mode 100644 src/game-server/attack.cpp delete mode 100644 src/game-server/attack.h delete mode 100644 src/game-server/combatcomponent.cpp delete mode 100644 src/game-server/combatcomponent.h delete mode 100644 src/game-server/monstercombatcomponent.cpp delete mode 100644 src/game-server/monstercombatcomponent.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e62a89b..f303716 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -205,8 +205,6 @@ SET(SRCS_MANASERVGAME game-server/accountconnection.cpp game-server/actor.h game-server/actor.cpp - game-server/attack.h - game-server/attack.cpp game-server/attribute.h game-server/attribute.cpp game-server/attributemanager.h @@ -219,8 +217,6 @@ SET(SRCS_MANASERVGAME game-server/character.cpp game-server/collisiondetection.h game-server/collisiondetection.cpp - game-server/combatcomponent.h - game-server/combatcomponent.cpp game-server/commandhandler.cpp game-server/commandhandler.h game-server/component.h @@ -248,8 +244,6 @@ SET(SRCS_MANASERVGAME game-server/mapreader.cpp game-server/monster.h game-server/monster.cpp - game-server/monstercombatcomponent.h - game-server/monstercombatcomponent.cpp game-server/monstermanager.h game-server/monstermanager.cpp game-server/npc.h diff --git a/src/common/manaserv_protocol.h b/src/common/manaserv_protocol.h index 73837b1..4e58413 100644 --- a/src/common/manaserv_protocol.h +++ b/src/common/manaserv_protocol.h @@ -145,8 +145,6 @@ enum { GPMSG_ITEMS = 0x0281, // { W item id, W*2 position }* GPMSG_BEING_ABILITY_POINT = 0x0282, // W being id, B abilityId, W*2 point GPMSG_BEING_ABILITY_BEING = 0x0283, // W being id, B abilityId, W target being id - PGMSG_ATTACK = 0x0290, // W being id - GPMSG_BEING_ATTACK = 0x0291, // W being id, B direction, B attack Id PGMSG_USE_ABILITY_ON_BEING = 0x0292, // B abilityID, W being id GPMSG_ABILITY_STATUS = 0x0293, // { B abilityID, D current, D max, D recharge } PGMSG_USE_ABILITY_ON_POINT = 0x0294, // B abilityID, W*2 position @@ -425,26 +423,11 @@ enum BeingAction { STAND, WALK, - ATTACK, SIT, DEAD, HURT }; -/** - * Moves enum for beings and actors for others players attack types. - * WARNING: Has to be in sync with the same enum in the Being class - * of the client! - */ -enum AttackType -{ - HIT = 0x00, - CRITICAL = 0x0a, - MULTI = 0x08, - REFLECT = 0x04, - FLEE = 0x0b -}; - /** * Beings and actors directions * WARNING: Has to be in sync with the same enum in the Being class diff --git a/src/game-server/actor.h b/src/game-server/actor.h index d1201aa..80f6bbb 100644 --- a/src/game-server/actor.h +++ b/src/game-server/actor.h @@ -33,14 +33,13 @@ enum { UPDATEFLAG_NEW_ON_MAP = 1, UPDATEFLAG_NEW_DESTINATION = 2, - UPDATEFLAG_ATTACK = 4, - UPDATEFLAG_ACTIONCHANGE = 8, - UPDATEFLAG_LOOKSCHANGE = 16, - UPDATEFLAG_DIRCHANGE = 32, - UPDATEFLAG_HEALTHCHANGE = 64, - UPDATEFLAG_EMOTE = 128, - UPDATEFLAG_ABILITY_ON_POINT = 256, - UPDATEFLAG_ABILITY_ON_BEING = 512 + UPDATEFLAG_ACTIONCHANGE = 4, + UPDATEFLAG_LOOKSCHANGE = 8, + UPDATEFLAG_DIRCHANGE = 16, + UPDATEFLAG_HEALTHCHANGE = 32, + UPDATEFLAG_EMOTE = 64, + UPDATEFLAG_ABILITY_ON_POINT = 128, + UPDATEFLAG_ABILITY_ON_BEING = 256 }; /** diff --git a/src/game-server/attack.cpp b/src/game-server/attack.cpp deleted file mode 100644 index 6ca85fb..0000000 --- a/src/game-server/attack.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - * The Mana Server - * Copyright (C) 2010 The Mana Development Team - * - * This file is part of The Mana Server. - * - * The Mana Server is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana Server is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana Server. If not, see . - */ - -#include "attack.h" - -#include - -#include "common/defines.h" - -#include "game-server/character.h" -#include "game-server/skillmanager.h" - -AttackInfo *AttackInfo::readAttackNode(xmlNodePtr node) -{ - std::string skill = XML::getProperty(node, "skill", std::string()); - - unsigned skillId; - if (utils::isNumeric(skill)) - skillId = utils::stringToInt(skill); - else - skillId = skillManager->getId(skill); - - if (!skill.empty() && !skillManager->exists(skillId)) - { - LOG_WARN("Error parsing Attack node: Invalid skill " << skill - << " taking default skill"); - skillId = skillManager->getDefaultSkillId(); - } - - unsigned id = XML::getProperty(node, "id", 0); - unsigned priority = XML::getProperty(node, "priority", 0); - unsigned warmupTime = XML::getProperty(node, "warmuptime", 0); - unsigned cooldownTime = XML::getProperty(node, "cooldowntime", 0); - unsigned reuseTime = XML::getProperty(node, "reusetime", 0); - unsigned short baseDamange = XML::getProperty(node, "basedamage", 0); - unsigned short deltaDamage = XML::getProperty(node, "deltadamage", 0); - unsigned short chanceToHit = XML::getProperty(node, "chancetohit", 0); - unsigned short range = XML::getProperty(node, "range", 0); - Element element = elementFromString( - XML::getProperty(node, "element", "neutral")); - DamageType type = damageTypeFromString( - XML::getProperty(node, "type", "other")); - - Damage dmg; - dmg.id = id; - dmg.skill = skillId; - dmg.base = baseDamange; - dmg.delta = deltaDamage; - dmg.cth = chanceToHit; - dmg.range = range; - dmg.element = element; - dmg.type = type; - AttackInfo *attack = new AttackInfo(priority, dmg, warmupTime, cooldownTime, - reuseTime); - return attack; -} - -void Attacks::add(CombatComponent *combatComponent, AttackInfo *attackInfo) -{ - mAttacks.push_back(Attack(attackInfo)); - attack_added.emit(combatComponent, *mAttacks.rbegin()); -} - -void Attacks::remove(CombatComponent *combatComponent, AttackInfo *attackInfo) -{ - for (std::vector::iterator it = mAttacks.begin(), - it_end = mAttacks.end(); it != it_end; ++it) - { - if ((*it).getAttackInfo() == attackInfo) - { - if (mCurrentAttack && mCurrentAttack->getAttackInfo() == attackInfo) - mCurrentAttack = 0; - attack_removed.emit(combatComponent, *it); - mAttacks.erase(it); - return; - } - } -} - -void Attacks::markAttackAsTriggered() -{ - mCurrentAttack->markAsTriggered(); - mCurrentAttack = 0; -} - -Attack *Attacks::getTriggerableAttack() -{ - if (!mCurrentAttack) - return 0; - - int cooldownTime = mCurrentAttack->getAttackInfo()->getCooldownTime(); - if (mAttackTimer.remaining() <= cooldownTime) - { - return mCurrentAttack; - } - - return 0; -} - -void Attacks::startAttack(Attack *attack) -{ - mCurrentAttack = attack; - mAttackTimer.set(attack->getAttackInfo()->getWarmupTime() + - attack->getAttackInfo()->getCooldownTime()); -} - -void Attacks::getUsuableAttacks(std::vector *ret) -{ - assert(ret != 0); - - // we have a current Attack - if ((!mAttackTimer.expired() && mCurrentAttack)) - return; - for (std::vector::iterator it = mAttacks.begin(); - it != mAttacks.end(); ++it) - { - Attack &attack = *it; - - if (attack.isUsuable()) - { - ret->push_back(&attack); - } - } -} diff --git a/src/game-server/attack.h b/src/game-server/attack.h deleted file mode 100644 index 8dc6262..0000000 --- a/src/game-server/attack.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * The Mana Server - * Copyright (C) 2010 The Mana Development Team - * - * This file is part of The Mana Server. - * - * The Mana Server is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana Server is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana Server. If not, see . - */ - -#ifndef ATTACK_H -#define ATTACK_H - -#include -#include -#include - -#include -#include - -#include "common/defines.h" - -#include "scripting/script.h" - -#include "utils/xml.h" - -#include "game-server/timeout.h" - -class CombatComponent; - -/** - * Structure that describes the severity and nature of an attack a being can - * be hit by. - */ -struct Damage -{ - unsigned id; /**< Id of the attack (needed for displaying animation clientside */ - unsigned skill; /**< Skill used by source (needed for exp calculation) */ - unsigned short base; /**< Base amount of damage. */ - unsigned short delta; /**< Additional damage when lucky. */ - unsigned short cth; /**< Chance to hit. Opposes the evade attribute. */ - Element element; /**< Elemental damage. */ - DamageType type; /**< Damage type: Physical or magical? */ - bool trueStrike; /**< Override dodge calculation */ - unsigned short range; /**< Maximum distance that this attack can be used from, in pixels */ - - Damage(): - id(0), - skill(0), - base(0), - delta(0), - cth(0), - element(ELEMENT_NEUTRAL), - type(DAMAGE_OTHER), - trueStrike(false), - range(DEFAULT_TILE_LENGTH) - {} -}; - -/** - * Class that stores information about an auto-attack - */ - -class CharacterComponent; - -struct AttackInfo -{ - public: - AttackInfo(unsigned priority, const Damage &damage, - unsigned short warmupTime, unsigned short cooldownTime, - unsigned short reuseTime): - mDamage(damage), - mCooldownTime(cooldownTime), - mWarmupTime(warmupTime), - mReuseTime(reuseTime), - mPriority(priority) - {} - - unsigned short getWarmupTime() const - { return mWarmupTime; } - - unsigned short getCooldownTime() const - { return mCooldownTime; } - - unsigned short getReuseTime() const - { return mReuseTime; } - - static AttackInfo *readAttackNode(xmlNodePtr node); - - Damage &getDamage() - { return mDamage; } - - const Script::Ref &getScriptCallback() const - { return mCallback; } - - void setCallback(Script *script) - { script->assignCallback(mCallback); } - - unsigned getPriority() const - { return mPriority; } - - private: - Damage mDamage; - - /** - * Value to reset the timer to (warmup + cooldown) - */ - unsigned short mCooldownTime; - - /** - * Pre-attack delay tick. - * This MUST be smaller than or equal to the aspd! - * So the attack triggers where timer == warmup, having gone through - * aspd - warmup ticks. - */ - unsigned short mWarmupTime; - - /** - * The global cooldown that needs to be finished before the being can - * use the next attack. - */ - unsigned short mReuseTime; - - /** - * Name of the script callback - */ - Script::Ref mCallback; - - /** - * Priority of the attack - */ - unsigned mPriority; -}; - -class Attack -{ - public: - Attack(AttackInfo *info): - mInfo(info) - {assert(info);} - - AttackInfo *getAttackInfo() - { return mInfo; } - - void markAsTriggered() - { mReuseTimer.set(mInfo->getCooldownTime() + mInfo->getReuseTime()); } - - bool isUsuable() const - { return mReuseTimer.expired(); } - - - private: - /** - * Contains infos about cooldown/damage/etc - */ - AttackInfo *mInfo; - - /** - * Internal timer that checks time for reuse - */ - Timeout mReuseTimer; -}; - -/** - * Helper class for storing multiple auto-attacks. - */ -class Attacks : public sigc::trackable -{ - public: - Attacks(): - mCurrentAttack(0) - {} - - void add(CombatComponent *combatComponent, AttackInfo *); - void remove(CombatComponent *combatComponent, AttackInfo *); - void markAttackAsTriggered(); - Attack *getTriggerableAttack(); - void startAttack(Attack *attack); - void getUsuableAttacks(std::vector *ret); - - /** - * Tells the number of attacks available - */ - unsigned getNumber() - { return mAttacks.size(); } - - sigc::signal attack_added; - sigc::signal attack_removed; - - private: - std::vector mAttacks; - - Attack *mCurrentAttack; - - /** - * when greater than cooldown -> warming up - * when equals cooldown -> trigger attack - * when smaller -> cooling down - */ - Timeout mAttackTimer; -}; - -#endif // ATTACK_H diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp index f3d4530..22ce30d 100644 --- a/src/game-server/being.cpp +++ b/src/game-server/being.cpp @@ -27,7 +27,6 @@ #include "game-server/attributemanager.h" #include "game-server/character.h" #include "game-server/collisiondetection.h" -#include "game-server/combatcomponent.h" #include "game-server/mapcomposite.h" #include "game-server/effect.h" #include "game-server/skillmanager.h" @@ -310,8 +309,8 @@ int BeingComponent::directionToAngle(int direction) void BeingComponent::setAction(Entity &entity, BeingAction action) { mAction = action; - if (action != ATTACK && // The players are informed about these actions - action != WALK) // by other messages + // The players are informed about these actions by other messages + if (action != WALK) { entity.getComponent()->raiseUpdateFlags( UPDATEFLAG_ACTIONCHANGE); diff --git a/src/game-server/being.h b/src/game-server/being.h index 5827ad1..aeb5697 100644 --- a/src/game-server/being.h +++ b/src/game-server/being.h @@ -29,9 +29,10 @@ #include "game-server/actor.h" #include "game-server/attribute.h" -#include "game-server/attack.h" #include "game-server/timeout.h" +#include "scripting/script.h" + class BeingComponent; class MapComposite; class StatusEffect; diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp index 3d23e3a..8831e50 100644 --- a/src/game-server/character.cpp +++ b/src/game-server/character.cpp @@ -22,10 +22,8 @@ #include "common/configuration.h" #include "game-server/accountconnection.h" -#include "game-server/attack.h" #include "game-server/attributemanager.h" #include "game-server/buysell.h" -#include "game-server/combatcomponent.h" #include "game-server/inventory.h" #include "game-server/item.h" #include "game-server/itemmanager.h" @@ -87,7 +85,6 @@ CharacterComponent::CharacterComponent(Entity &entity, MessageIn &msg): mTransaction(TRANS_NONE), mTalkNpcId(0), mNpcThread(0), - mKnuckleAttackInfo(0), mBaseEntity(&entity) { auto *beingComponent = entity.getComponent(); @@ -106,29 +103,6 @@ CharacterComponent::CharacterComponent(Entity &entity, MessageIn &msg): actorComponent->setSize(16); - CombatComponent *combatcomponent = new CombatComponent(entity); - entity.addComponent(combatcomponent); - combatcomponent->getAttacks().attack_added.connect( - sigc::mem_fun(this, &CharacterComponent::attackAdded)); - combatcomponent->getAttacks().attack_removed.connect( - sigc::mem_fun(this, &CharacterComponent::attackRemoved)); - - // Default knuckle attack - int damageBase = beingComponent->getModifiedAttribute(ATTR_STR); - int damageDelta = damageBase / 2; - Damage knuckleDamage; - knuckleDamage.skill = skillManager->getDefaultSkillId(); - knuckleDamage.base = damageBase; - knuckleDamage.delta = damageDelta; - knuckleDamage.cth = 2; - knuckleDamage.element = ELEMENT_NEUTRAL; - knuckleDamage.type = DAMAGE_PHYSICAL; - knuckleDamage.range = DEFAULT_TILE_LENGTH; - - mKnuckleAttackInfo = new AttackInfo(0, knuckleDamage, 7, 3, 0); - combatcomponent->addAttack(mKnuckleAttackInfo); - - auto *abilityComponent = new AbilityComponent(entity); entity.addComponent(abilityComponent); abilityComponent->signal_ability_changed.connect( @@ -157,7 +131,6 @@ CharacterComponent::CharacterComponent(Entity &entity, MessageIn &msg): CharacterComponent::~CharacterComponent() { delete mNpcThread; - delete mKnuckleAttackInfo; } void CharacterComponent::update(Entity &entity) @@ -198,8 +171,6 @@ void CharacterComponent::respawn(Entity &entity) // Make it alive again beingComponent->setAction(entity, STAND); - // Reset target - entity.getComponent()->clearTarget(); // Execute respawn callback when set if (executeCallback(mDeathAcceptedCallback, entity)) @@ -379,15 +350,6 @@ void CharacterComponent::attributeChanged(Entity *entity, unsigned attr) beingComponent->getAttributeBase(attr), beingComponent->getModifiedAttribute(attr)); mModifiedAttributes.insert(attr); - - // Update the knuckle Attack if required - if (attr == ATTR_STR && mKnuckleAttackInfo) - { - // TODO: dehardcode this - Damage &knuckleDamage = mKnuckleAttackInfo->getDamage(); - knuckleDamage.base = beingComponent->getModifiedAttribute(ATTR_STR); - knuckleDamage.delta = knuckleDamage.base / 2; - } } int CharacterComponent::expForLevel(int level) @@ -602,23 +564,6 @@ void CharacterComponent::resumeNpcThread() } } -void CharacterComponent::attackAdded(CombatComponent *combatComponent, - Attack &attack) -{ - // Remove knuckle attack - if (attack.getAttackInfo() != mKnuckleAttackInfo) - combatComponent->removeAttack(mKnuckleAttackInfo); -} - -void CharacterComponent::attackRemoved(CombatComponent *combatComponent, - Attack &attack) -{ - // Add knuckle attack - // 1 since the attack is not really removed yet. - if (combatComponent->getAttacks().getNumber() == 1) - combatComponent->addAttack(mKnuckleAttackInfo); -} - void CharacterComponent::disconnected(Entity &entity) { mConnected = false; diff --git a/src/game-server/character.h b/src/game-server/character.h index 78d27ec..6f090aa 100644 --- a/src/game-server/character.h +++ b/src/game-server/character.h @@ -131,8 +131,6 @@ class CharacterComponent : public Component */ void update(Entity &entity); - void processAttacks(); - /** * Executes the global die script */ @@ -386,9 +384,6 @@ class CharacterComponent : public Component void triggerLoginCallback(Entity &entity); - void attackAdded(CombatComponent *combatComponent, Attack &attackInfo); - void attackRemoved(CombatComponent *combatComponent, Attack &attackInfo); - sigc::signal signal_disconnected; private: @@ -482,8 +477,6 @@ class CharacterComponent : public Component Timeout mMuteTimeout; /**< Time until the character is no longer muted */ - AttackInfo *mKnuckleAttackInfo; - Entity *mBaseEntity; /**< The entity this component is part of this is ONLY required to allow using the serialization routine without many diff --git a/src/game-server/combatcomponent.cpp b/src/game-server/combatcomponent.cpp deleted file mode 100644 index 65eddc4..0000000 --- a/src/game-server/combatcomponent.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* - * The Mana Server - * Copyright (C) 2013 The Mana Developers - * - * This file is part of The Mana Server. - * - * The Mana Server is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana Server is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana Server. If not, see . - */ - -#include "combatcomponent.h" - -#include "game-server/being.h" -#include "game-server/mapcomposite.h" - -#include "utils/logger.h" - -CombatComponent::CombatComponent(Entity &being): - mTarget(nullptr), - mCurrentAttack(nullptr) -{ - being.getComponent()->signal_died.connect(sigc::mem_fun( - this, &CombatComponent::diedOrRemoved)); - being.signal_removed.connect(sigc::mem_fun(this, - &CombatComponent::diedOrRemoved)); -} - -CombatComponent::~CombatComponent() -{ -} - -void CombatComponent::update(Entity &entity) -{ - auto *beingComponent = entity.getComponent(); - - if (beingComponent->getAction() != ATTACK || !mTarget) - return; - - std::vector attacksReady; - mAttacks.getUsuableAttacks(&attacksReady); - - if (Attack *triggerableAttack = mAttacks.getTriggerableAttack()) - { - processAttack(entity, *triggerableAttack); - mAttacks.markAttackAsTriggered(); - } - - // Deal with the ATTACK action. - if (attacksReady.empty()) - return; - - Attack *highestPriorityAttack = 0; - // Performs all ready attacks. - for (std::vector::const_iterator it = attacksReady.begin(), - it_end = attacksReady.end(); it != it_end; ++it) - { - const Point &attackerPosition = - entity.getComponent()->getPosition(); - const Point &targetPosition = - mTarget->getComponent()->getPosition(); - - // check if target is in range using the pythagorean theorem - int distx = attackerPosition.x - targetPosition.x; - int disty = attackerPosition.y - targetPosition.y; - int distSquare = (distx * distx + disty * disty); - AttackInfo *info = (*it)->getAttackInfo(); - int maxDist = info->getDamage().range + - entity.getComponent()->getSize(); - - if (distSquare <= maxDist * maxDist && - (!highestPriorityAttack || - highestPriorityAttack->getAttackInfo()->getPriority() - < info->getPriority())) - { - highestPriorityAttack = *it; - } - } - if (highestPriorityAttack) - { - mAttacks.startAttack(highestPriorityAttack); - mCurrentAttack = highestPriorityAttack; - const Point &point = - entity.getComponent()->getPosition(); - beingComponent->setDestination(entity, point); - // TODO: Turn into direction of enemy - entity.getComponent()->raiseUpdateFlags( - UPDATEFLAG_ATTACK); - } -} - -/** - * Takes a damage structure, computes the real damage based on the - * stats, deducts the result from the hitpoints and adds the result to - * the HitsTaken list. - */ -int CombatComponent::damage(Entity &target, - Entity *source, - const Damage &damage) -{ - auto *beingComponent = target.getComponent(); - - int HPloss = damage.base; - if (damage.delta) - HPloss += rand() * (damage.delta + 1) / RAND_MAX; - - // TODO magical attacks and associated elemental modifiers - switch (damage.type) - { - case DAMAGE_PHYSICAL: - { - const double dodge = - beingComponent->getModifiedAttribute(ATTR_DODGE); - if (!damage.trueStrike && rand()%((int)dodge + 1) > - rand()%(damage.cth + 1)) - { - HPloss = 0; - // TODO Process triggers for a dodged physical attack here. - // If there is an attacker included, also process triggers for the attacker (failed physical strike) - } - else - { - const double defense = - beingComponent->getModifiedAttribute(ATTR_DEFENSE); - HPloss = HPloss * (1.0 - (0.0159375f * defense) / - (1.0 + 0.017 * defense)) + - (rand()%((HPloss / 16) + 1)); - // TODO Process triggers for receiving damage here. - // If there is an attacker included, also process triggers for the attacker (successful physical strike) - } - break; - } - case DAMAGE_MAGICAL: -#if 0 - beingComponent.getModifiedAttribute(BASE_ELEM_BEGIN + damage.element); -#else - LOG_WARN("Attempt to use magical type damage! This has not been" - "implemented yet and should not be used!"); - HPloss = 0; -#endif - break; - case DAMAGE_DIRECT: - break; - default: - LOG_WARN("Unknown damage type '" << damage.type << "'!"); - break; - } - - if (HPloss > 0) - { - const Attribute *HP = beingComponent->getAttribute(ATTR_HP); - LOG_DEBUG("Being " - << target.getComponent()->getPublicID() - << " suffered " << HPloss - << " damage. HP: " - << HP->getModifiedAttribute() << "/" - << beingComponent->getModifiedAttribute(ATTR_MAX_HP)); - beingComponent->setAttribute(target, ATTR_HP, HP->getBase() - HPloss); - // No HP regen after being hit if this is set. - // TODO: Reenable this once the attributes are available as a component - // A bit too fuzzy to implement at the moment - //mHealthRegenerationTimeout.setSoft( - // Configuration::getValue("game_hpRegenBreakAfterHit", 0)); - } - else - { - HPloss = 0; - } - - signal_damaged.emit(source, damage, HPloss); - return HPloss; -} - -/** - * Performs an attack - */ -void CombatComponent::processAttack(Entity &source, Attack &attack) -{ - performAttack(source, attack.getAttackInfo()->getDamage()); -} - -/** - * Adds an attack to the available attacks - */ -void CombatComponent::addAttack(AttackInfo *attackInfo) -{ - mAttacks.add(this, attackInfo); -} - -/** - * Removes an attack from the available attacks - */ -void CombatComponent::removeAttack(AttackInfo *attackInfo) -{ - mAttacks.remove(this, attackInfo); -} - -/** - * Performs an attack. - */ -int CombatComponent::performAttack(Entity &source, const Damage &dmg) -{ - // check target legality - if (!mTarget - || mTarget == &source - || mTarget->getComponent()->getAction() == DEAD - || !mTarget->canFight()) - return -1; - - if (source.getMap()->getPvP() == PVP_NONE - && mTarget->getType() == OBJECT_CHARACTER - && source.getType() == OBJECT_CHARACTER) - return -1; - - return mTarget->getComponent()->damage(*mTarget, - &source, dmg); -} diff --git a/src/game-server/combatcomponent.h b/src/game-server/combatcomponent.h deleted file mode 100644 index 1a4f310..0000000 --- a/src/game-server/combatcomponent.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * The Mana Server - * Copyright (C) 2013 The Mana Developers - * - * This file is part of The Mana Server. - * - * The Mana Server is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana Server is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana Server. If not, see . - */ - -#ifndef COMBATCOMPONENT_H -#define COMBATCOMPONENT_H - -#include "component.h" - -#include - -#include - -#include "game-server/attack.h" - -class Entity; - -class CombatComponent: public Component -{ -public: - static const ComponentType type = CT_Fighting; - - CombatComponent(Entity &being); - virtual ~CombatComponent(); - - void update(Entity &entity); - - void addAttack(AttackInfo *attack); - void removeAttack(AttackInfo *attackInfo); - Attacks &getAttacks(); - - int performAttack(Entity &source, const Damage &dmg); - virtual int damage(Entity &target, Entity *source, const Damage &damage); - - int getAttackId() const; - - Entity *getTarget() const; - void setTarget(Entity *target); - void clearTarget(); - - void diedOrRemoved(Entity *entity); - - sigc::signal signal_damaged; - -protected: - virtual void processAttack(Entity &source, Attack &attack); - - Entity *mTarget; - Attacks mAttacks; - Attack *mCurrentAttack; // Last used attack - -}; - -inline Attacks &CombatComponent::getAttacks() -{ - return mAttacks; -} - -/** - * Gets the attack id the being is currently performing. - * For being, this is defaulted to the first one (1). - */ -inline int CombatComponent::getAttackId() const -{ - return mCurrentAttack ? - mCurrentAttack->getAttackInfo()->getDamage().id : 0; -} - -/** - * Get Target - */ -inline Entity *CombatComponent::getTarget() const -{ - return mTarget; -} - -/** - * Set Target - */ -inline void CombatComponent::setTarget(Entity *target) -{ - mTarget = target; -} - -/** - * Clears the target - */ -inline void CombatComponent::clearTarget() -{ - mTarget = nullptr; -} - -/** - * Handler for the died and removed event of the targeting being - * @param entity The removed/died being (not used here) - */ -inline void CombatComponent::diedOrRemoved(Entity *entity) -{ - clearTarget(); -} - -#endif // COMBATCOMPONENT_H diff --git a/src/game-server/gamehandler.cpp b/src/game-server/gamehandler.cpp index b1a87a2..e9890c6 100644 --- a/src/game-server/gamehandler.cpp +++ b/src/game-server/gamehandler.cpp @@ -27,7 +27,6 @@ #include "common/transaction.h" #include "game-server/accountconnection.h" #include "game-server/buysell.h" -#include "game-server/combatcomponent.h" #include "game-server/commandhandler.h" #include "game-server/emotemanager.h" #include "game-server/inventory.h" @@ -254,10 +253,6 @@ void GameHandler::processMessage(NetComputer *computer, MessageIn &message) handleMoveItem(client, message); break; - case PGMSG_ATTACK: - handleAttack(client, message); - break; - case PGMSG_USE_ABILITY_ON_BEING: handleUseAbilityOnBeing(client, message); break; @@ -671,22 +666,6 @@ void GameHandler::handleMoveItem(GameClient &client, MessageIn &message) TRANS_ITEM_MOVE, str.str()); } -void GameHandler::handleAttack(GameClient &client, MessageIn &message) -{ - int id = message.readInt16(); - const int publicId = - client.character->getComponent()->getPublicID(); - LOG_DEBUG("Character " << publicId << " attacked being " << id); - - Entity *being = findBeingNear(client.character, id); - if (being && being->getType() != OBJECT_NPC) - { - client.character->getComponent()->setTarget(being); - client.character->getComponent()->setAction( - *client.character, ATTACK); - } -} - void GameHandler::handleUseAbilityOnBeing(GameClient &client, MessageIn &message) { if (client.character->getComponent()->getAction() == DEAD) @@ -719,7 +698,7 @@ void GameHandler::handleUseAbilityOnPoint(GameClient &client, MessageIn &message const int publicId = client.character->getComponent()->getPublicID(); LOG_DEBUG("Character " << publicId - << " tries to use his ability attack " << abilityID); + << " tries to use his ability " << abilityID); auto *abilityComponent = client.character ->getComponent(); abilityComponent->useAbilityOnPoint(*client.character, abilityID, x, y); diff --git a/src/game-server/gamehandler.h b/src/game-server/gamehandler.h index 0abc287..2f44a3c 100644 --- a/src/game-server/gamehandler.h +++ b/src/game-server/gamehandler.h @@ -134,7 +134,6 @@ class GameHandler: public ConnectionHandler void handleUnequip(GameClient &client, MessageIn &message); void handleMoveItem(GameClient &client, MessageIn &message); - void handleAttack(GameClient &client, MessageIn &message); void handleUseAbilityOnBeing(GameClient &client, MessageIn &message); void handleUseAbilityOnPoint(GameClient &client, MessageIn &message); void handleActionChange(GameClient &client, MessageIn &message); diff --git a/src/game-server/item.cpp b/src/game-server/item.cpp index 444576f..589fc01 100644 --- a/src/game-server/item.cpp +++ b/src/game-server/item.cpp @@ -22,10 +22,8 @@ #include "game-server/item.h" #include "common/configuration.h" -#include "game-server/attack.h" #include "game-server/attributemanager.h" #include "game-server/being.h" -#include "game-server/combatcomponent.h" #include "game-server/state.h" #include "scripting/script.h" #include "scripting/scriptmanager.h" @@ -53,17 +51,6 @@ void ItemEffectAttrMod::dispell(Entity *itemUser) mId, !mDuration); } -bool ItemEffectAttack::apply(Entity *itemUser) -{ - itemUser->getComponent()->addAttack(mAttackInfo); - return false; -} - -void ItemEffectAttack::dispell(Entity *itemUser) -{ - itemUser->getComponent()->removeAttack(mAttackInfo); -} - ItemEffectScript::~ItemEffectScript() { } @@ -110,13 +97,6 @@ ItemClass::~ItemClass() delete mEffects.begin()->second; mEffects.erase(mEffects.begin()); } - - for (std::vector::iterator it = mAttackInfos.begin(), - it_end = mAttackInfos.end(); - it != it_end; ++it) - { - delete *it; - } } void ItemClass::addEffect(ItemEffectInfo *effect, @@ -148,14 +128,6 @@ bool ItemClass::useTrigger(Entity *itemUser, ItemTriggerType trigger) return ret; } -void ItemClass::addAttack(AttackInfo *attackInfo, - ItemTriggerType applyTrigger, - ItemTriggerType dispellTrigger) -{ - mAttackInfos.push_back(attackInfo); - addEffect(new ItemEffectAttack(attackInfo), applyTrigger, dispellTrigger); -} - ItemComponent::ItemComponent(ItemClass *type, int amount) : mType(type), mAmount(amount) diff --git a/src/game-server/item.h b/src/game-server/item.h index 7624209..e627b42 100644 --- a/src/game-server/item.h +++ b/src/game-server/item.h @@ -25,7 +25,6 @@ #include #include "game-server/actor.h" -#include "game-server/attack.h" #include "scripting/script.h" class Entity; @@ -86,7 +85,6 @@ enum ItemEffectType // Effects that are removed automatically when the trigger ends // (ie. item no longer exists in invy, unequipped) IET_ATTR_MOD = 0, // Modify a given attribute with a given value - IET_ATTACK, // Give the associated being an attack // Effects that do not need any automatic removal IET_COOLDOWN, // Set a cooldown to this item, preventing activation for n ticks IET_G_COOLDOWN, // Set a cooldown to all items of this type for this being @@ -129,19 +127,6 @@ class ItemEffectAttrMod : public ItemEffectInfo unsigned mId; }; -class ItemEffectAttack : public ItemEffectInfo -{ - public: - ItemEffectAttack(AttackInfo *attackInfo) : - mAttackInfo(attackInfo) - {} - - bool apply(Entity *itemUser); - void dispell(Entity *itemUser); - private: - AttackInfo *mAttackInfo; -}; - class ItemEffectConsumes : public ItemEffectInfo { public: @@ -250,12 +235,6 @@ class ItemClass Script::Ref getEventCallback(const std::string &event) const { return mEventCallbacks.value(event); } - void addAttack(AttackInfo *attackInfo, ItemTriggerType applyTrigger, - ItemTriggerType dispellTrigger); - - std::vector &getAttackInfos() - { return mAttackInfos; } - private: /** * Add an effect to a trigger @@ -290,8 +269,6 @@ class ItemClass */ utils::NameMap mEventCallbacks; - std::vector mAttackInfos; - friend class ItemManager; }; diff --git a/src/game-server/itemmanager.cpp b/src/game-server/itemmanager.cpp index 05dd0d0..0362c5d 100644 --- a/src/game-server/itemmanager.cpp +++ b/src/game-server/itemmanager.cpp @@ -346,12 +346,6 @@ void ItemManager::readEffectNode(xmlNodePtr effectNode, ItemClass *item) duration), triggerType.apply, triggerType.dispell); } - else if (xmlStrEqual(subNode->name, BAD_CAST "attack")) - { - AttackInfo *attackInfo = AttackInfo::readAttackNode(subNode); - item->addAttack(attackInfo, triggerType.apply, triggerType.dispell); - - } // Having a dispell for the next three is nonsensical. else if (xmlStrEqual(subNode->name, BAD_CAST "cooldown")) { diff --git a/src/game-server/mapcomposite.cpp b/src/game-server/mapcomposite.cpp index 4a5d800..82f3cd7 100644 --- a/src/game-server/mapcomposite.cpp +++ b/src/game-server/mapcomposite.cpp @@ -26,7 +26,6 @@ #include "common/configuration.h" #include "common/resourcemanager.h" #include "game-server/character.h" -#include "game-server/combatcomponent.h" #include "game-server/mapcomposite.h" #include "game-server/map.h" #include "game-server/mapmanager.h" @@ -596,13 +595,6 @@ void MapComposite::remove(Entity *ptr) for (std::vector::iterator i = mContent->entities.begin(), i_end = mContent->entities.end(); i != i_end; ++i) { - if ((*i)->canFight()) - { - if ((*i)->getComponent()->getTarget() == ptr) - { - (*i)->getComponent()->clearTarget(); - } - } if (*i == ptr) { i = mContent->entities.erase(i); diff --git a/src/game-server/monster.cpp b/src/game-server/monster.cpp index 5d77db4..e0feed9 100644 --- a/src/game-server/monster.cpp +++ b/src/game-server/monster.cpp @@ -28,7 +28,6 @@ #include "game-server/item.h" #include "game-server/map.h" #include "game-server/mapcomposite.h" -#include "game-server/monstercombatcomponent.h" #include "game-server/state.h" #include "scripting/scriptmanager.h" #include "utils/logger.h" @@ -36,15 +35,6 @@ #include -MonsterClass::~MonsterClass() -{ - for (std::vector::iterator it = mAttacks.begin(), - it_end = mAttacks.end(); it != it_end; ++it) - { - delete *it; - } -} - double MonsterClass::getVulnerability(Element element) const { Vulnerabilities::const_iterator it = mVulnerabilities.find(element); @@ -98,24 +88,6 @@ MonsterComponent::MonsterComponent(Entity &entity, MonsterClass *specy): beingComponent->signal_died.connect(sigc::mem_fun(this, &MonsterComponent::monsterDied)); - - // Set positions relative to target from which the monster can attack - int dist = specy->getAttackDistance(); - mAttackPositions.push_back(AttackPosition(dist, 0, LEFT)); - mAttackPositions.push_back(AttackPosition(-dist, 0, RIGHT)); - mAttackPositions.push_back(AttackPosition(0, -dist, DOWN)); - mAttackPositions.push_back(AttackPosition(0, dist, UP)); - - MonsterCombatComponent *combatComponent = - new MonsterCombatComponent(entity, specy); - entity.addComponent(combatComponent); - - double damageMutation = mutation ? - (100.0 + (rand() % (mutation * 2)) - mutation) / 100.0 : 1.0; - combatComponent->setDamageMutation(damageMutation); - - combatComponent->signal_damaged.connect( - sigc::mem_fun(this, &MonsterComponent::receivedDamage)); } MonsterComponent::~MonsterComponent() @@ -146,12 +118,6 @@ void MonsterComponent::update(Entity &entity) script->execute(entity.getMap()); } - refreshTarget(entity); - - // Cancel the rest when we have a target - if (entity.getComponent()->getTarget()) - return; - const Point &position = entity.getComponent()->getPosition(); @@ -176,97 +142,6 @@ void MonsterComponent::update(Entity &entity) } } -void MonsterComponent::refreshTarget(Entity &entity) -{ - auto *beingComponent = entity.getComponent(); - - // We are dead and sadly not possible to keep attacking :( - if (beingComponent->getAction() == DEAD) - return; - - // Check potential attack positions - int bestTargetPriority = 0; - Entity *bestTarget = 0; - Point bestAttackPosition; - - // reset Target. We will find a new one if possible - entity.getComponent()->clearTarget(); - - // Iterate through objects nearby - int aroundArea = Configuration::getValue("game_visualRange", 448); - for (BeingIterator i(entity.getMap()->getAroundBeingIterator(&entity, - aroundArea)); - i; ++i) - { - // We only want to attack player characters - if ((*i)->getType() != OBJECT_CHARACTER) - continue; - - Entity *target = *i; - - // Dead characters are ignored - if (beingComponent->getAction() == DEAD) - continue; - - // Determine how much we hate the target - int targetPriority = 0; - std::map::iterator angerIterator = - mAnger.find(target); - if (angerIterator != mAnger.end()) - { - const AggressionInfo &aggressionInfo = angerIterator->second; - targetPriority = aggressionInfo.anger; - } - else if (mSpecy->isAggressive()) - { - targetPriority = 1; - } - else - { - continue; - } - - // Check all attack positions - for (std::list::iterator j = mAttackPositions.begin(); - j != mAttackPositions.end(); j++) - { - Point attackPosition = - target->getComponent()->getPosition(); - attackPosition.x += j->x; - attackPosition.y += j->y; - - int posPriority = calculatePositionPriority(entity, - attackPosition, - targetPriority); - if (posPriority > bestTargetPriority) - { - bestTargetPriority = posPriority; - bestTarget = target; - bestAttackPosition = attackPosition; - } - } - } - if (bestTarget) - { - const Point &ownPosition = - entity.getComponent()->getPosition(); - const Point &targetPosition = - bestTarget->getComponent()->getPosition(); - - entity.getComponent()->setTarget(bestTarget); - if (bestAttackPosition == ownPosition) - { - beingComponent->setAction(entity, ATTACK); - beingComponent->updateDirection(entity, ownPosition, - targetPosition); - } - else - { - beingComponent->setDestination(entity, bestAttackPosition); - } - } -} - int MonsterComponent::calculatePositionPriority(Entity &entity, Point position, int targetPriority) @@ -301,133 +176,8 @@ int MonsterComponent::calculatePositionPriority(Entity &entity, return targetPriority * (range - path.size()); } } - -void MonsterComponent::forgetTarget(Entity *entity) -{ - { - AggressionInfo &aggressionInfo = mAnger[entity]; - aggressionInfo.removedConnection.disconnect(); - aggressionInfo.diedConnection.disconnect(); - } - mAnger.erase(entity); - - if (entity->getType() == OBJECT_CHARACTER) - { - mExpReceivers.erase(entity); - mLegalExpReceivers.erase(entity); - } -} - -void MonsterComponent::changeAnger(Entity *target, int amount) -{ - const EntityType type = target->getType(); - if (type != OBJECT_MONSTER && type != OBJECT_CHARACTER) - return; - - if (mAnger.find(target) != mAnger.end()) - { - mAnger[target].anger += amount; - } - else - { - AggressionInfo &aggressionInfo = mAnger[target]; - aggressionInfo.anger = amount; - - // Forget target either when it's removed or died, whichever - // happens first. - aggressionInfo.removedConnection = - target->signal_removed.connect(sigc::mem_fun(this, &MonsterComponent::forgetTarget)); - aggressionInfo.diedConnection = target->getComponent() - ->signal_died.connect( - sigc::mem_fun(this, &MonsterComponent::forgetTarget)); - } -} - -std::map MonsterComponent::getAngerList() const -{ - std::map result; - std::map::const_iterator i, i_end; - - for (i = mAnger.begin(), i_end = mAnger.end(); i != i_end; ++i) - { - const AggressionInfo &aggressionInfo = i->second; - result.insert(std::make_pair(i->first, aggressionInfo.anger)); - } - - return result; -} - void MonsterComponent::monsterDied(Entity *monster) { mDecayTimeout.set(DECAY_TIME); - - if (mExpReceivers.size() > 0) - { - // If the monster was killed by players, randomly drop items. - const unsigned size = mSpecy->mDrops.size(); - for (unsigned i = 0; i < size; i++) - { - const int p = rand() / (RAND_MAX / 10000); - const MonsterDrop &drop = mSpecy->mDrops[i]; - - if (p <= drop.probability) - { - const Point &position = - monster->getComponent()->getPosition(); - Entity *item = Item::create(monster->getMap(), position, - drop.item, 1); - GameState::enqueueInsert(item); - } - } - - // Distribute exp reward. - std::map > ::iterator iChar; - std::set::iterator iSkill; - - - float expPerChar = (float)mSpecy->getExp() / mExpReceivers.size(); - - for (iChar = mExpReceivers.begin(); iChar != mExpReceivers.end(); - iChar++) - { - auto *character = (*iChar).first; - const std::set &skillSet = (*iChar).second; - - if (mLegalExpReceivers.find(character) == mLegalExpReceivers.end() - || skillSet.empty()) - continue; - - auto characterComponent = - character->getComponent(); - - int expPerSkill = int(expPerChar / skillSet.size()); - for (iSkill = skillSet.begin(); iSkill != skillSet.end(); - iSkill++) - { - characterComponent->receiveExperience(*iSkill, expPerSkill, - mSpecy->getOptimalLevel()); - } - characterComponent->incrementKillCount(mSpecy->getId()); - } - } } - -void MonsterComponent::receivedDamage(Entity *source, const Damage &damage, int hpLoss) -{ - if (source) - changeAnger(source, hpLoss); - - if (hpLoss && source && source->getType() == OBJECT_CHARACTER) - { - mExpReceivers[source].insert(damage.skill); - if (mKillStealProtectedTimeout.expired() || mOwner == source - || mOwner->getComponent()->getParty() == - source->getComponent()->getParty()) - { - mOwner = source; - mLegalExpReceivers.insert(source); - mKillStealProtectedTimeout.set(KILLSTEAL_PROTECTION_TIME); - } - } -} diff --git a/src/game-server/monster.h b/src/game-server/monster.h index 2e23820..4949d4c 100644 --- a/src/game-server/monster.h +++ b/src/game-server/monster.h @@ -49,22 +49,6 @@ struct MonsterDrop typedef std::vector< MonsterDrop > MonsterDrops; -/** - * Structure containing different attack types of a monster type - */ -struct MonsterAttack -{ - unsigned id; - int priority; - float damageFactor; - Element element; - DamageType type; - int preDelay; - int aftDelay; - int range; - std::string scriptEvent; -}; - typedef std::map Vulnerabilities; /** @@ -88,8 +72,6 @@ class MonsterClass mOptimalLevel(0) {} - ~MonsterClass(); - /** * Returns monster type. This is the Id of the monster class. */ @@ -195,12 +177,6 @@ class MonsterClass /** Returns preferred combat distance in pixels. */ unsigned getAttackDistance() const { return mAttackDistance; } - /** Adds an attack to the monsters repertoire. */ - void addAttack(AttackInfo *info) { mAttacks.push_back(info); } - - /** Returns all attacks of the monster. */ - std::vector &getAttackInfos() { return mAttacks; } - void setVulnerability(Element element, double factor) { mVulnerabilities[element] = factor; } @@ -235,7 +211,6 @@ class MonsterClass int mMutation; int mAttackDistance; int mOptimalLevel; - std::vector mAttacks; Vulnerabilities mVulnerabilities; /** @@ -252,23 +227,6 @@ class MonsterClass friend class MonsterComponent; }; -/** - * Structure holding possible positions relative to the target from which - * the monster can attack - */ -struct AttackPosition -{ - AttackPosition(int posX, int posY, BeingDirection dir): - x(posX), - y(posY), - direction(dir) - {} - - int x; - int y; - BeingDirection direction; -}; - /** * The component for a fightable monster with its own AI */ @@ -294,15 +252,11 @@ class MonsterComponent : public Component */ void update(Entity &entity); - void refreshTarget(Entity &entity); - /** * Signal handler */ void monsterDied(Entity *monster); - void receivedDamage(Entity *attacker, const Damage &damage, int hpLoss); - /** * Alters hate for the monster */ @@ -334,27 +288,18 @@ class MonsterComponent : public Component sigc::connection removedConnection; sigc::connection diedConnection; }; - std::map mAnger; /** * Character who currently owns this monster (killsteal protection). */ Entity *mOwner; - /** List of characters and their skills that attacked this monster. */ - std::map > mExpReceivers; - /** * List of characters who are entitled to receive exp (killsteal * protection). */ std::set mLegalExpReceivers; - /** - * Set positions relative to target from which the monster can attack. - */ - std::list mAttackPositions; - /** Time until monster strolls to new location */ Timeout mStrollTimeout; /** Kill steal protection time */ diff --git a/src/game-server/monstercombatcomponent.cpp b/src/game-server/monstercombatcomponent.cpp deleted file mode 100644 index 35e2f24..0000000 --- a/src/game-server/monstercombatcomponent.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - * The Mana Server - * Copyright (C) 2013 The Mana Developers - * - * This file is part of The Mana Server. - * - * The Mana Server is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana Server is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana Server. If not, see . - */ - -#include "game-server/monstercombatcomponent.h" - -#include "game-server/monster.h" -#include "scripting/scriptmanager.h" - -MonsterCombatComponent::MonsterCombatComponent(Entity &monster, - MonsterClass *specy): - CombatComponent(monster), - mDamageMutation(0) -{ - for (auto &attack : specy->getAttackInfos()) - { - addAttack(attack); - } -} - -/** - * Performs an attack - */ -void MonsterCombatComponent::processAttack(Entity *source, Attack &attack) -{ - if (!mTarget) - { - source->getComponent()->setAction(*source, STAND); - return; - } - - Damage dmg = attack.getAttackInfo()->getDamage(); - dmg.skill = 0; - dmg.base *= mDamageMutation; - dmg.delta *= mDamageMutation; - - int hit = performAttack(*mTarget, attack.getAttackInfo()->getDamage()); - - const Script::Ref &scriptCallback = - attack.getAttackInfo()->getScriptCallback(); - - if (scriptCallback.isValid() && hit > -1) - { - Script *script = ScriptManager::currentState(); - script->prepare(scriptCallback); - script->push(source); - script->push(mTarget); - script->push(hit); - script->execute(source->getMap()); - } -} - -/** - * Calls the damage function in Being and updates the aggro list - */ -int MonsterCombatComponent::damage(Entity &target, - Entity *source, - const Damage &damage) -{ - Damage newDamage = damage; - MonsterClass *specy = target.getComponent()->getSpecy(); - float factor = specy->getVulnerability(newDamage.element); - newDamage.base = newDamage.base * factor; - newDamage.delta = newDamage.delta * factor; - int hpLoss = CombatComponent::damage(target, source, newDamage); - - - if (specy->getDamageCallback().isValid()) - { - Script *script = ScriptManager::currentState(); - script->prepare(specy->getDamageCallback()); - script->push(&target); - script->push(source); - script->push(hpLoss); - // TODO: add exact damage parameters as well - script->execute(target.getMap()); - } - return hpLoss; -} diff --git a/src/game-server/monstercombatcomponent.h b/src/game-server/monstercombatcomponent.h deleted file mode 100644 index 36afa26..0000000 --- a/src/game-server/monstercombatcomponent.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * The Mana Server - * Copyright (C) 2013 The Mana Developers - * - * This file is part of The Mana Server. - * - * The Mana Server is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana Server is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana Server. If not, see . - */ - -#ifndef MONSTERCOMBATCOMPONENT_H -#define MONSTERCOMBATCOMPONENT_H - -#include "game-server/combatcomponent.h" - -#include "game-server/attack.h" -#include "game-server/being.h" - -class MonsterClass; - -class MonsterCombatComponent: public CombatComponent -{ -public: - MonsterCombatComponent(Entity &monster, MonsterClass *specy); - - void processAttack(Entity *source, Attack &attack); - int damage(Entity &target, Entity *source, const Damage &damage); - - void setDamageMutation(double mutation); - -private: - double mDamageMutation; -}; - -/** - * Sets the mutation of the damage compared to the default damage of the specy - * @param mutation - */ -inline void MonsterCombatComponent::setDamageMutation(double mutation) -{ - mDamageMutation = mutation; -} - -#endif /* MONSTERCOMBATCOMPONENT_H */ diff --git a/src/game-server/monstermanager.cpp b/src/game-server/monstermanager.cpp index 3a9d791..df8c690 100644 --- a/src/game-server/monstermanager.cpp +++ b/src/game-server/monstermanager.cpp @@ -235,45 +235,6 @@ void MonsterManager::readMonsterNode(xmlNodePtr node, const std::string &filenam monster->setAttackDistance( XML::getProperty(subnode, "attack-distance", 0)); } - else if (xmlStrEqual(subnode->name, BAD_CAST "attack")) - { - AttackInfo *att = AttackInfo::readAttackNode(subnode); - bool validMonsterAttack = true; - - if (att->getDamage().id < 1) - { - LOG_WARN(filename - << ": Attack without ID for monster Id:" - << id << " (" << name << ") - attack ignored"); - validMonsterAttack = false; - } - else if (att->getDamage().element == ELEMENT_ILLEGAL) - { - LOG_WARN(filename - << ": Attack with unknown element for monster Id:" - << id << " (" << name << ") - attack ignored"); - validMonsterAttack = false; - } - else if (att->getDamage().type == DAMAGE_OTHER) - { - LOG_WARN(filename - << ": Attack with unknown damage type " - << "for monster Id:" << id - << " (" << name << ")"); - validMonsterAttack = false; - } - - if (validMonsterAttack) - { - monster->addAttack(att); - } - else - { - delete att; - att = 0; - } - - } else if (xmlStrEqual(subnode->name, BAD_CAST "vulnerability")) { Element element = elementFromString( diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp index 5bca9c9..e16a4e7 100644 --- a/src/game-server/state.cpp +++ b/src/game-server/state.cpp @@ -23,7 +23,6 @@ #include "common/configuration.h" #include "game-server/accountconnection.h" #include "game-server/effect.h" -#include "game-server/combatcomponent.h" #include "game-server/gamehandler.h" #include "game-server/inventory.h" #include "game-server/item.h" @@ -166,19 +165,6 @@ static void informPlayer(MapComposite *map, Entity *p) if (wereInRange && willBeInRange) { - // Send attack messages. - if ((oflags & UPDATEFLAG_ATTACK) && oid != pid) - { - MessageOut AttackMsg(GPMSG_BEING_ATTACK); - AttackMsg.writeInt16(oid); - AttackMsg.writeInt8( - o->getComponent()->getDirection()); - CombatComponent *combatComponent = - o->getComponent(); - AttackMsg.writeInt8(combatComponent->getAttackId()); - gameHandler->sendTo(p, AttackMsg); - } - // Send action change messages. if ((oflags & UPDATEFLAG_ACTIONCHANGE)) { diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 6258af3..258b9bc 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -33,7 +33,6 @@ extern "C" { #include "game-server/buysell.h" #include "game-server/character.h" #include "game-server/collisiondetection.h" -#include "game-server/combatcomponent.h" #include "game-server/effect.h" #include "game-server/gamehandler.h" #include "game-server/inventory.h" @@ -1382,88 +1381,6 @@ static int entity_walk(lua_State *s) return 0; } -/** LUA entity:damage (being) - * entity:damage(int damage, int delta, - * int accuracy, int type, int element) - * entity:damage(int damage, int delta, int accuracy, - * int type, int element, handle source) - * entity:damage(int damage, int delta, int accuracy, - * int type, int element, handle source, int skill) - * entity:damage(int damage, int delta, int accuracy, - * int type, int element, handle source, string skillname) - ** - * Valid only for being entities. - * - * Inflicts damage to the being. The severity of the attack is between - * ''damage'' and (''damage'' + ''delta'') and is calculated using the normal - * [[damage calculation]] rules. The being has a chance to - * [[hitting and dodging|dodge the attack]] with its - * [[attributes|agility attribute]]. The ''accuracy'' decides how hard this is. - * - * If ''source'' is provided the attack is handled as if the ''source'' - * triggered the damage. - * - * If ''skill'' is given the ''owner'' can also recieve XP for the attack. The - * ''skill'' should be defined in the [[skills.xml|skills.xml]]. If the skill - * is provided as string (''skillname'') you have to use this format: - * _. So for example: "Weapons_Unarmed" - * - * ''type'' affects which kind of armor and character attributes reduce the - * damage. It can be one of the following values: - * | 0 | DAMAGE_PHYSICAL | - * | 1 | DAMAGE_MAGICAL | - * | 2 | DAMAGE_OTHER | - * - * ''element'' decides how the [[element system]] changes the damage. The - * following values are possible: - * | 0 | ELEMENT_NEUTRAL | - * | 1 | ELEMENT_FIRE | - * | 2 | ELEMENT_WATER | - * | 3 | ELEMENT_EARTH | - * | 4 | ELEMENT_AIR | - * | 5 | ELEMENT_LIGHTNING | - * | 6 | ELEMENT_METAL | - * | 7 | ELEMENT_WOOD | - * | 8 | ELEMENT_ICE | - * - * **Return Value**: Actual HP reduction resulting from the attack. - */ -static int entity_damage(lua_State *s) -{ - Entity *being = checkBeing(s, 1); - - if (!being->canFight()) - { - luaL_error(s, "damage called with victim that cannot fight"); - return 0; - } - - Damage dmg; - dmg.base = luaL_checkint(s, 2); - dmg.delta = luaL_checkint(s, 3); - dmg.cth = luaL_checkint(s, 4); - dmg.type = (DamageType)luaL_checkint(s, 5); - dmg.element = (Element)luaL_checkint(s, 6); - Entity *source = 0; - if (lua_gettop(s) >= 7) - { - source = checkBeing(s, 7); - - if (!source->canFight()) - { - luaL_error(s, "damage called with source that cannot fight"); - return 0; - } - } - if (lua_gettop(s) >= 8) - { - dmg.skill = checkSkill(s, 8); - } - being->getComponent()->damage(*being, source, dmg); - - return 0; -} - /** LUA entity:heal (being) * entity:heal([int value]) ** @@ -1532,10 +1449,9 @@ static int entity_get_type(lua_State *s) * * | 0 | ACTION_STAND | * | 1 | ACTION_WALK | - * | 2 | ACTION_ATTACK | - * | 3 | ACTION_SIT | - * | 4 | ACTION_DEAD | - * | 5 | ACTION_HURT | + * | 2 | ACTION_SIT | + * | 3 | ACTION_DEAD | + * | 4 | ACTION_HURT | */ static int entity_get_action(lua_State *s) { @@ -2398,55 +2314,6 @@ static int entity_get_monster_id(lua_State *s) return 1; } -/** LUA entity:change_anger (monster) - * entity:change_anger(handle being, int anger) - ** - * Valid only for monster entities. - * - * Makes the monster more angry about the ''being'' by adding ''anger'' to the - * being. - */ -static int entity_change_anger(lua_State *s) -{ - Entity *monster = checkMonster(s, 1); - Entity *being = checkBeing(s, 2); - const int anger = luaL_checkint(s, 3); - monster->getComponent()->changeAnger(being, anger); - return 0; -} - -/** LUA entity:drop_anger (monster) - * entity:drop_anger(handle target) - ** - * Valid only for monster entities. - * - * Will drop all anger against the ''target''. - */ -static int entity_drop_anger(lua_State *s) -{ - Entity *monster = checkMonster(s, 1); - Entity *being = checkBeing(s, 2); - monster->getComponent()->forgetTarget(being); - return 0; -} - -/** LUA entity:get_angerlist (monster) - * entity:get_angerlist() - ** - * Valid only for monster entities. - * - * **Return value:** A table with the beings as key and the anger against them - * as values. - */ -static int entity_get_angerlist(lua_State *s) -{ - Entity *monster = checkMonster(s, 1); - MonsterComponent *monsterComponent = - monster->getComponent(); - pushSTLContainer(s, monsterComponent->getAngerList()); - return 1; -} - /** LUA_CATEGORY Status effects (statuseffects) */ @@ -3071,36 +2938,6 @@ static int monster_class_on_update(lua_State *s) return 0; } -/** LUA monsterclass:on_damage (monsterclass) - * monsterclass:on_damage(function callback) - ** - * Assigns the ''callback'' as callback for the monster damage event. - * This callback will be called every time when a monster takes damage. - * The damage can be either invoked from scripts or from other beings such - * as players. The parameters of the callback are: the attacked monster, - * the being dealing the damage and the hp loss - * - * **Note:** See [[scripting#get_monster_class|get_monster_class]] for getting - * a monsterclass object. - * - * **Example:** - * local function damage(mob, aggressor, hploss) - * mob:say("I took damage -.- ".. hploss) - * if aggressor then - * mob:say("Curse you, ".. aggressor:name()) - * end - * end - * local maggot = get_monster_class("maggot") - * maggot:on_damage(damage) - */ -static int monster_class_on_damage(lua_State *s) -{ - MonsterClass *monsterClass = LuaMonsterClass::check(s, 1); - luaL_checktype(s, 2, LUA_TFUNCTION); - monsterClass->setDamageCallback(getScript(s)); - return 0; -} - /** LUA monsterclass:name (monsterclass) * monsterclass:name() ** @@ -3113,234 +2950,6 @@ static int monster_class_get_name(lua_State *s) return 1; } -/** LUA monsterclass:attacks (monsterclass) - * monsterclass:attacks() - ** - * **Return value:** This function returns a table with all attacks of the - * monster. See the [[scripting#AttackInfo class|Attack Info]] section. - */ -static int monster_class_attacks(lua_State *s) -{ - MonsterClass *monsterClass = LuaMonsterClass::check(s, 1); - pushSTLContainer(s, monsterClass->getAttackInfos()); - return 1; -} - - -/** LUA_CATEGORY AttackInfo class (attackinfoclass) - * The AttackInfo class reveals info about attacks and provides functions to - * register callbacks on attacks. See the - * [[attackconfiguration|Attack Configuration]] for more info. - * To get an AttackInfo use - * [[scripting#monsterclass:attacks|monsterclass:attacks]] or - * [[scripting#itemclass:attacks|itemclass:attacks]] - */ - -/** LUA attackinfo:priority (attackinfoclass) - * attackinfo:priority() - ** - * **Return value:** This function returns the priority of the attack. - */ -static int attack_get_priority(lua_State *s) -{ - AttackInfo *attack = LuaAttackInfo::check(s, 1); - lua_pushinteger(s, attack->getPriority()); - return 1; -} - -/** LUA attackinfo:cooldowntime (attackinfoclass) - * attackinfo:cooldowntime() - ** - * **Return value:** This function returns the cooldowntime (time after dealing - * damage after which a new attack can be used) of the attack. - */ -static int attack_get_cooldowntime(lua_State *s) -{ - AttackInfo *attack = LuaAttackInfo::check(s, 1); - lua_pushinteger(s, attack->getCooldownTime()); - return 1; -} - -/** LUA attackinfo:warmuptime (attackinfoclass) - * attackinfo:warmuptime() - ** - * **Return value:** This function returns the warmuptime (time before a attack - * triggers damage after being used) of the attack. - */ -static int attack_get_warmuptime(lua_State *s) -{ - AttackInfo *attack = LuaAttackInfo::check(s, 1); - lua_pushinteger(s, attack->getWarmupTime()); - return 1; -} - -/** LUA attackinfo:reusetime (attackinfoclass) - * attackinfo:reusetime() - ** - * **Return value:** This function returns the reusetime (time after which the - * same attack can be used again) of the attack. - */ -static int attack_get_reusetime(lua_State *s) -{ - AttackInfo *attack = LuaAttackInfo::check(s, 1); - lua_pushinteger(s, attack->getReuseTime()); - return 1; -} - -/** LUA attackinfo:damage (attackinfoclass) - * attackinfo:damage() - ** - * **Return value:** This function returns the damage info of the attack. - * - * **See also:** [[scripting#Damage Class|Damage Class]] - */ -static int attack_get_damage(lua_State *s) -{ - AttackInfo *attack = LuaAttackInfo::check(s, 1); - LuaDamage::push(s, &attack->getDamage()); - return 1; -} - -/** LUA attackinfo:on_attack (attackinfoclass) - * attackinfo:on_attack(function callback) - ** - * Assigns a callback to the attack that will be called as soon the attack is - * used. The callback will get called with the following parameters: - * being user, being target, int damage_dealt. - */ -static int attack_on_attack(lua_State *s) -{ - AttackInfo *attack = LuaAttackInfo::check(s, 1); - luaL_checktype(s, 2, LUA_TFUNCTION); - attack->setCallback(getScript(s)); - return 0; -} - - -/** LUA_CATEGORY Damage Class (damageclass) - * The Damage class provides info about the kind of damage attack deals. - */ - -/** LUA damage:id (damageclass) - * damage:id() - ** - * **Return value:** This function returns the id of the attack. - */ -static int damage_get_id(lua_State *s) -{ - Damage *damage = LuaDamage::check(s, 1); - lua_pushinteger(s, damage->id); - return 1; -} - -/** LUA damage:skill (damageclass) - * damage:skill() - ** - * **Return value:** This function returns the skill id of the attack. If the - * damage dealer is a character is a character this skill will recieve exp. - */ -static int damage_get_skill(lua_State *s) -{ - Damage *damage = LuaDamage::check(s, 1); - lua_pushinteger(s, damage->skill); - return 1; -} - -/** LUA damage:base (damageclass) - * damage:base() - ** - * **Return value:** This function returns the base damage of the attack. - * It is the minimum of damage dealt. - */ -static int damage_get_base(lua_State *s) -{ - Damage *damage = LuaDamage::check(s, 1); - lua_pushinteger(s, damage->base); - return 1; -} - -/** LUA damage:delta (damageclass) - * damage:delta() - ** - * **Return value:** This function returns the damage delta of the attack. - * base damage + delta damage is the maximum of damage the attack can cause. - * A number in between will be picked by random. - */ -static int damage_get_delta(lua_State *s) -{ - Damage *damage = LuaDamage::check(s, 1); - lua_pushinteger(s, damage->delta); - return 1; -} - -/** LUA damage:cth (damageclass) - * damage:cth() - ** - * **Return value:** This function returns the chance to hit of the attack. - * This number is not a percent value but some factor. Higher means a better - * chance to hit. FIXME: Add info about the factor. - */ -static int damage_get_cth(lua_State *s) -{ - Damage *damage = LuaDamage::check(s, 1); - lua_pushinteger(s, damage->cth); - return 1; -} - -/** LUA damage:element (damageclass) - * damage:element() - ** - * **Return value:** This function returns the element of the attack. - * - * **See:** [[scripting#entitydamage|entity:damage]] for possible values. - */ -static int damage_get_element(lua_State *s) -{ - Damage *damage = LuaDamage::check(s, 1); - lua_pushinteger(s, damage->element); - return 1; -} - -/** LUA damage:type (damageclass) - * damage:type() - ** - * **Return value:** This function returns the type of the attack. - * - * **See:** [[scripting#entitydamage|entity:damage]] for possible values. - */ -static int damage_get_type(lua_State *s) -{ - Damage *damage = LuaDamage::check(s, 1); - lua_pushinteger(s, damage->type); - return 1; -} - -/** LUA damage:is_truestrike (damageclass) - * damage:is_truestrike() - ** - * **Return value:** This function returns whether the attack is a true strike. - * A true strike is not effected by chance of hit or anything that could - * prevent the hit. - */ -static int damage_is_truestrike(lua_State *s) -{ - Damage *damage = LuaDamage::check(s, 1); - lua_pushboolean(s, damage->trueStrike); - return 1; -} - -/** LUA damage:range (damageclass) - * damage:range() - ** - * **Return value:** This function returns the range of the attack in pixels. - */ -static int damage_get_range(lua_State *s) -{ - Damage *damage = LuaDamage::check(s, 1); - lua_pushinteger(s, damage->range); - return 1; -} - /** LUA_CATEGORY Map object class (mapobjectclass) */ @@ -3507,23 +3116,6 @@ static int item_class_get_name(lua_State *s) return 1; } -/** LUA itemclass:attacks (itemclass) - * itemclass:attacks() - ** - * **Return value:** Returns a list of all attacks the item offers. - * - * **See:** the [[scripting#AttackInfo Class|AttackInfo class]] for more info - * about how to use the values in the list. - */ -static int item_class_attacks(lua_State *s) -{ - ItemClass *itemClass = LuaItemClass::check(s, 1); - std::vector attacks = itemClass->getAttackInfos(); - pushSTLContainer(s, attacks); - return 1; -} - - /** * Returns four useless tables for testing the STL container push wrappers. * This function can be removed when there are more useful functions which use @@ -3682,29 +3274,6 @@ LuaScript::LuaScript(): #endif lua_pop(mRootState, 1); // pop the globals table - static luaL_Reg const members_AttackInfo[] = { - { "priority", attack_get_priority }, - { "cooldowntime", attack_get_cooldowntime }, - { "warmuptime", attack_get_warmuptime }, - { "reusetime", attack_get_reusetime }, - { "damage", attack_get_damage }, - { "on_attack", attack_on_attack }, - { nullptr, nullptr } - }; - - static luaL_Reg const members_Damage[] = { - { "id", damage_get_id }, - { "skill", damage_get_skill }, - { "base", damage_get_base }, - { "delta", damage_get_delta }, - { "cth", damage_get_cth }, - { "element", damage_get_element }, - { "type", damage_get_type }, - { "is_truestrike", damage_is_truestrike }, - { "range", damage_get_range }, - { nullptr, nullptr } - }; - static luaL_Reg const members_Entity[] = { { "remove", entity_remove }, { "say", entity_say }, @@ -3721,7 +3290,6 @@ LuaScript::LuaScript(): { "ability_mana", entity_get_ability_mana }, { "cooldown_ability", entity_cooldown_ability }, { "walk", entity_walk }, - { "damage", entity_damage }, { "heal", entity_heal }, { "name", entity_get_name }, { "type", entity_get_type }, @@ -3760,9 +3328,6 @@ LuaScript::LuaScript(): { "has_ability", entity_has_ability }, { "take_ability", entity_take_ability }, { "monster_id", entity_get_monster_id }, - { "change_anger", entity_change_anger }, - { "drop_anger", entity_drop_anger }, - { "angerlist", entity_get_angerlist }, { "apply_status", entity_apply_status }, { "remove_status", entity_remove_status }, { "has_status", entity_has_status }, @@ -3775,7 +3340,6 @@ LuaScript::LuaScript(): static luaL_Reg const members_ItemClass[] = { { "on", item_class_on }, { "name", item_class_get_name }, - { "attacks", item_class_attacks }, { nullptr, nullptr } }; @@ -3789,9 +3353,7 @@ LuaScript::LuaScript(): static luaL_Reg const members_MonsterClass[] = { { "on_update", monster_class_on_update }, - { "on_damage", monster_class_on_damage }, { "name", monster_class_get_name }, - { "attacks", monster_class_attacks }, { nullptr, nullptr } }; @@ -3810,8 +3372,6 @@ LuaScript::LuaScript(): { nullptr, nullptr} }; - LuaAttackInfo::registerType(mRootState, "Attack", members_AttackInfo); - LuaDamage::registerType(mRootState, "Damage", members_Damage); LuaEntity::registerType(mRootState, "Entity", members_Entity); LuaItemClass::registerType(mRootState, "ItemClass", members_ItemClass); LuaMapObject::registerType(mRootState, "MapObject", members_MapObject); diff --git a/src/scripting/luautil.h b/src/scripting/luautil.h index 9ea11c0..e7cbc75 100644 --- a/src/scripting/luautil.h +++ b/src/scripting/luautil.h @@ -34,7 +34,6 @@ extern "C" { #include #include -#include "game-server/attack.h" #include "game-server/abilitymanager.h" class CharacterComponent; @@ -159,8 +158,6 @@ private: template const char * LuaUserData::mTypeName; -typedef LuaUserData LuaAttackInfo; -typedef LuaUserData LuaDamage; typedef LuaUserData LuaEntity; typedef LuaUserData LuaItemClass; typedef LuaUserData LuaMapObject; @@ -210,11 +207,6 @@ inline void push(lua_State *s, double val) lua_pushnumber(s, val); } -inline void push(lua_State *s, AttackInfo *val) -{ - LuaAttackInfo::push(s, val); -} - inline void push(lua_State *s, MapObject *val) { LuaMapObject::push(s, val); -- cgit