Mercurial > sumwars
changeset 1456:58aa83b9cf74 0.5.2
programmed quick fix for messed up berserk mod: ranged only fighter will use range attack at melee range when berserking
author | wuha |
---|---|
date | Thu, 02 Sep 2010 15:56:14 +0000 |
parents | 0184d5a6bbea |
children | 0cc922bed067 |
files | data/playerclasses/testclasses.xml src/core/creature.cpp src/core/world.cpp |
diffstat | 3 files changed, 28 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/data/playerclasses/testclasses.xml Wed Sep 01 17:46:43 2010 +0000 +++ b/data/playerclasses/testclasses.xml Thu Sep 02 15:56:14 2010 +0000 @@ -1,3 +1,4 @@ +<!-- <PlayerClass type="_testclass" name="_testclass"> <BasicAttributes max_health="200" @@ -54,4 +55,5 @@ <LearnableAbility type="testbooster" skilltree_tab="1" skilltree_posx="0.200000" skilltree_posy="0.250000" required_level="1"/> <LearnableAbility type="teststatushealer" skilltree_tab="1" skilltree_posx="0.200000" skilltree_posy="0.650000" required_level="1"/> -</PlayerClass> \ No newline at end of file +</PlayerClass> +--> \ No newline at end of file
--- a/src/core/creature.cpp Wed Sep 01 17:46:43 2010 +0000 +++ b/src/core/creature.cpp Thu Sep 02 15:56:14 2010 +0000 @@ -265,7 +265,7 @@ m_action.m_elapsed_time = 0; Action::ActionInfo* aci = Action::getActionInfo(m_action.m_type); - + // Stumm behandeln if (m_dyn_attr.m_status_mod_time[Damage::MUTE]>0 ) { @@ -334,6 +334,29 @@ // setzen der Standarddauer der Aktion m_action.m_time = getActionTime(m_action.m_type); + + if (getBaseAttrMod()->m_abilities.count(m_action.m_type) == 0 && m_action.m_type!= "noaction" && m_action.m_type!= "die" && m_action.m_type != "walk") + { + // this happens, when action is not present due to berserk + // TODO: better strategy for berserk + std::map<std::string, AbilityInfo>::iterator it; + for (it = getBaseAttrMod()->m_abilities.begin(); it != getBaseAttrMod()->m_abilities.end(); ++it) + { + if (it->first == "noaction" || it->first == "die" || it->first == "walk") + continue; + + Action::ActionInfo* aci2 = Action::getActionInfo(it->first); + if (aci2 != 0 && aci->m_timer_nr == 0) + { + m_action.m_type = it->first; + m_action.m_time = getActionTime(m_action.m_type); + + DEBUGX("set berserk action to %s",m_action.m_type.c_str()); + + break; + } + } + } Action::ActionType baseact = "noaction"; Action::ActionInfo* ainfo = Action::getActionInfo(m_action.m_type);
--- a/src/core/world.cpp Wed Sep 01 17:46:43 2010 +0000 +++ b/src/core/world.cpp Thu Sep 02 15:56:14 2010 +0000 @@ -1491,7 +1491,7 @@ if (m_network->getSlotStatus()!=NET_CONNECTED) { // disconnect - if (m_network->getSlotStatus() == NET_TIMEOUT) + if (m_network->getSlotStatus() == NET_TIMEOUT && m_local_player != 0) { m_local_player->setState(GameObject::STATE_QUIT,false); }