Index: ai_pet_dummy.cpp =================================================================== --- ai_pet_dummy.cpp (revision 3050) +++ ai_pet_dummy.cpp (working copy) @@ -95,10 +95,21 @@ } void CAIPetDummy::ActionAbilityStart() -{ +{ // New method to determining wyvern type: 1 = healer, 2 = hybrid, and 3 = offensive. 3 is default indicating no subjob. + int WyvernType = 3; + if(m_PPet->PMaster->GetSJob()==JOB_BLM || m_PPet->PMaster->GetSJob()==JOB_BLU || m_PPet->PMaster->GetSJob()==JOB_SMN || m_PPet->PMaster->GetSJob()==JOB_WHM || m_PPet->PMaster->GetSJob()==JOB_RDM || m_PPet->PMaster->GetSJob()==JOB_SCH){ + WyvernType = 1; + } + if(m_PPet->PMaster->GetSJob()==JOB_DRK || m_PPet->PMaster->GetSJob()==JOB_PLD || m_PPet->PMaster->GetSJob()==JOB_NIN || m_PPet->PMaster->GetSJob()==JOB_BRD){ + WyvernType = 2; + } + if(m_PPet->PMaster->GetSJob()==JOB_WAR || m_PPet->PMaster->GetSJob()==JOB_SAM || m_PPet->PMaster->GetSJob()==JOB_THF || m_PPet->PMaster->GetSJob()==JOB_BST || m_PPet->PMaster->GetSJob()==JOB_MNK || m_PPet->PMaster->GetSJob()==JOB_PUP || m_PPet->PMaster->GetSJob()==JOB_RNG || m_PPet->PMaster->GetSJob()==JOB_COR || m_PPet->PMaster->GetSJob()==JOB_DNC){ + WyvernType = 3; + } if(m_PPet->objtype == TYPE_MOB && m_PPet->PMaster->objtype == TYPE_PC) { - if(m_MasterCommand == MASTERCOMMAND_SIC && m_PPet->health.tp >= 100 && m_PBattleTarget != NULL) + + if(m_MasterCommand == MASTERCOMMAND_SIC && m_PPet->health.tp>=100 && m_PBattleTarget != NULL) { m_MasterCommand = MASTERCOMMAND_NONE; CMobEntity* PMob = (CMobEntity*)m_PPet->PMaster->PPet; @@ -137,7 +148,7 @@ m_MasterCommand = MASTERCOMMAND_NONE; } else if(m_PPet->getPetType()==PETTYPE_WYVERN){ - if(m_MasterCommand==MASTERCOMMAND_ELEMENTAL_BREATH && (m_PPet->GetMJob()==JOB_DRG || m_PPet->GetMJob()==JOB_RDM)){ + if(m_MasterCommand==MASTERCOMMAND_ELEMENTAL_BREATH && (WyvernType == 2 || WyvernType == 3)){ m_MasterCommand = MASTERCOMMAND_NONE; //offensive or multipurpose wyvern @@ -162,7 +173,7 @@ } } - else if(m_MasterCommand==MASTERCOMMAND_HEALING_BREATH && (m_PPet->GetMJob()==JOB_WHM || m_PPet->GetMJob()==JOB_RDM)){ + else if(m_MasterCommand==MASTERCOMMAND_HEALING_BREATH && (WyvernType == 1 || WyvernType == 2)){ m_MasterCommand = MASTERCOMMAND_NONE; m_PBattleSubTarget = NULL; //TODO: CHECK FOR STATUS EFFECTS FOR REMOVE- BREATH (higher priority than healing breaths) @@ -170,24 +181,49 @@ // if(m_PPet->PMaster->PParty==NULL){//solo with master-kun uint16 masterHead = ((CCharEntity*)(m_PPet->PMaster))->getStorage(LOC_INVENTORY)->GetItem(((CCharEntity*)(m_PPet->PMaster))->equip[SLOT_HEAD])->getID(); if(((CCharEntity*)(m_PPet->PMaster))->objtype == TYPE_PC && (masterHead == 12519 || masterHead == 15238)) { //Check for player & AF head, or +1 - if(m_PPet->PMaster->GetHPP() <= 50 && m_PPet->GetMJob()==JOB_WHM){//healer wyvern + if(m_PPet->PMaster->GetHPP() <= 50 && WyvernType == 1){//healer wyvern m_PBattleSubTarget = m_PPet->PMaster; + } - else if(m_PPet->PMaster->GetHPP() <= 33 && m_PPet->GetMJob()==JOB_RDM){//hybrid wyvern + else if(m_PPet->PMaster->GetHPP() <= 33 && WyvernType == 2){//hybrid wyvern m_PBattleSubTarget = m_PPet->PMaster; } + else { + // Theoretically this for loop checks the party members of the master, then checks the HP to see if it matches, then it sets the party member as the target of the HB + for(int i=0; iPMaster->PParty->members.size();i++){ + if(m_PPet->PMaster->PParty->members.at(i)->GetHPP() <= 50 && WyvernType == 1 && m_PBattleSubTarget == NULL){ + m_PBattleSubTarget = m_PPet->PMaster->PParty->members.at(i); + } + else { + if(m_PPet->PMaster->PParty->members.at(i)->GetHPP() <= 33 && WyvernType == 2 && m_PBattleSubTarget == NULL){ + m_PBattleSubTarget = m_PPet->PMaster->PParty->members.at(i); + } + } + } + } } else { - if(m_PPet->PMaster->GetHPP() <= 33 && m_PPet->GetMJob()==JOB_WHM){//healer wyvern + if(m_PPet->PMaster->GetHPP() <= 33 && WyvernType == 1){//healer wyvern m_PBattleSubTarget = m_PPet->PMaster; } - else if(m_PPet->PMaster->GetHPP() <= 25 && m_PPet->GetMJob()==JOB_RDM){//hybrid wyvern + else if(m_PPet->PMaster->GetHPP() <= 25 && WyvernType == 2){//hybrid wyvern m_PBattleSubTarget = m_PPet->PMaster; - } else { - // you shouldn't be here - DSP_DEBUG_BREAK_IF(true); } + else { + // Theoretically this for loop checks the party members of the master, then checks the HP to see if it matches, then it sets the party member as the target of the HB + for(int i=0; iPMaster->PParty->members.size();i++){ + if(m_PPet->PMaster->PParty->members.at(i)->GetHPP() <= 33 && WyvernType == 1 && m_PBattleSubTarget == NULL){ + m_PBattleSubTarget = m_PPet->PMaster->PParty->members.at(i); + } + else { + if(m_PPet->PMaster->PParty->members.at(i)->GetHPP() <= 25 && WyvernType == 2 && m_PBattleSubTarget == NULL){ + m_PBattleSubTarget = m_PPet->PMaster->PParty->members.at(i); + } + } + } + } } - // } + + // } // else{ //group play // //for( int i=0; i< // } @@ -229,22 +265,10 @@ m_PPet->m_ActionList.clear(); // find correct targe - if(m_PMobSkill->getValidTargets() & TARGET_SELF) - { //self + if(m_PMobSkill->getValidTargets() & TARGET_SELF){ //self m_PBattleSubTarget = m_PPet; - } - else if(m_PMobSkill->getValidTargets() & TARGET_PLAYER_PARTY) - { - ShowDebug("Target me!\n"); - m_PBattleSubTarget = m_PPet->PMaster; - } - else - { - if(m_PBattleTarget != NULL) - { - m_PBattleSubTarget = m_PBattleTarget; - } - DSP_DEBUG_BREAK_IF(m_PBattleSubTarget == NULL); + } else { + m_PBattleSubTarget = m_PBattleTarget; battleutils::MoveIntoRange(m_PPet, m_PBattleSubTarget, 25); } @@ -267,7 +291,7 @@ m_ActionType = ACTION_MOBABILITY_USING; } else{ - ShowWarning("ai_pet_dummy::ActionAbilityFinish Pet skill is null \n"); + ShowDebug("ai_pet_dummy::ActionAbilityFinish Pet skill is null \n"); m_ActionType = ACTION_ATTACK; ActionAttack(); } @@ -363,10 +387,17 @@ DSP_DEBUG_BREAK_IF(m_PMobSkill == NULL); DSP_DEBUG_BREAK_IF(m_PBattleSubTarget == NULL); + apAction_t Action; + + Action.ActionTarget = NULL; + Action.reaction = REACTION_HIT; + Action.speceffect = SPECEFFECT_HIT; + Action.animation = m_PMobSkill->getAnimationID(); + Action.subparam = m_PMobSkill->getMsgForAction(); + Action.flag = 0; + // reset AoE finder - m_PTargetFinder->reset(); - m_PPet->m_ActionList.clear(); - + m_PTargetFinder->reset(&Action); float distance = m_PMobSkill->getDistance(); if(m_PTargetFinder->isWithinRange(m_PBattleSubTarget, distance)) @@ -388,44 +419,32 @@ } } - uint16 totalTargets = m_PTargetFinder->m_targets.size(); + uint16 totalTargets = m_PPet->m_ActionList.size(); //call the script for each monster hit m_PMobSkill->setTotalTargets(totalTargets); m_PMobSkill->setTP(m_skillTP); - apAction_t Action; - Action.ActionTarget = NULL; - Action.reaction = REACTION_HIT; - Action.speceffect = SPECEFFECT_HIT; - Action.animation = m_PMobSkill->getAnimationID(); - Action.subparam = m_PMobSkill->getMsgForAction(); - Action.flag = 0; + apAction_t* currentAction; - uint16 msg = 0; - for (std::vector::iterator it = m_PTargetFinder->m_targets.begin() ; it != m_PTargetFinder->m_targets.end(); ++it) - { + for (uint32 i = 0; i < totalTargets; ++i){ + currentAction = &m_PPet->m_ActionList.at(i); - CBattleEntity* PTarget = *it; + CBattleEntity* PTarget = currentAction->ActionTarget; - Action.ActionTarget = PTarget; - m_PMobSkill->resetMsg(); if(m_PPet->isBstPet()){ - Action.param = luautils::OnMobWeaponSkill(PTarget, m_PPet, m_PMobSkill); + currentAction->param = luautils::OnMobWeaponSkill(PTarget, m_PPet, m_PMobSkill); } else { - Action.param = luautils::OnPetAbility(PTarget, m_PPet, m_PMobSkill, m_PPet->PMaster); + currentAction->param = luautils::OnPetAbility(PTarget, m_PPet, m_PMobSkill, m_PPet->PMaster); } - if(msg == 0){ - msg = m_PMobSkill->getMsg(); + if(i == 0){ + currentAction->messageID = m_PMobSkill->getMsg(); } else { - msg = m_PMobSkill->getAoEMsg(); + currentAction->messageID = m_PMobSkill->getAoEMsg(); } - Action.messageID = msg; - - m_PPet->m_ActionList.push_back(Action); } m_PPet->loc.zone->PushPacket(m_PPet, CHAR_INRANGE, new CActionPacket(m_PPet));