std::string ArmyTroop::GetDefenseString(void) const { if(Troop::GetDefense() == GetDefense()) return GetString(Troop::GetDefense()); std::ostringstream os; os << Troop::GetDefense() << " (" << GetDefense() << ")"; return os.str(); }
void CTurtle::Update(float fElapsedTime) { m_vAnimations[m_nCurrAnimation].Update(fElapsedTime); if(GetExperience() >= (100 * GetLevel())) { CBattleMap::GetInstance()->PlaySFX(CAssets::GetInstance()->aBMcowabungaSnd); SetExperience(0/*GetExperience()-(100* GetLevel())*/); SetLevel(GetLevel() + 1); SetHealthMax((int)((float)GetMaxHealth() * 1.25f)); SetHealth((int)((float)GetMaxHealth())); SetBaseAP(GetBaseAP()+2); SetStrength( (int)( (float)GetStrength() * 1.2f ) ); SetDefense( (int) ( (float)GetDefense() * 1.2f ) ); SetAccuracy( (int) ( (float)GetAccuracy() * 1.2f ) ); SetSpeed( (int) ( (float)GetSpeed() * 1.2f ) ); } if( GetHealth() <= 0) { if(GetAlive() == true) { CBattleMap::GetInstance()->DecrementNumChars(); CBattleMap::GetInstance()->DecrementNumTurtles(); CBattleMap::GetInstance()->SetTurtleDead(); SetAlive(false); if(GetCurrAnimNum() != 9) SetCurrAnim(9); SetPosZ(0.9f); } } }
// set monster stats values bool CMonster::SetStats( ) { if(thisnpc==NULL) return false; Stats->Level = thisnpc->level; Stats->Attack_Power = GetAttackPower( ); Stats->Defense = GetDefense( ); Stats->Attack_Speed = GetAttackSpeed( ); Stats->Move_Speed = GetMoveSpeed( ); Stats->Dodge = GetDodge( ); Stats->Accury = GetAccury( ); Stats->Critical = GetCritical( ); Stats->Magic_Defense = GetMagicDefense( ); Stats->Attack_Distance = GetAttackDistance( ); Stats->MaxHP = GetMaxHP( ); Stats->MaxMP = GetMaxMP( ); //Stats->HP = Stats->MaxHP; //Stats->MP = Stats->MaxMP; for(int i=0; i<20; i++) { AIVar[i] = 0; } return true; }
void Game::SaveMap(string PathToMap) { ofstream File(PathToMap + "Enemies.txt"); File.clear(); for(auto itr = Enemies.begin(); itr != Enemies.end(); ++itr) { File << itr->ID << " " << itr->GetAttack() << " " << itr->GetDefense() << " " << itr->GetHealth() << " " << itr->GetLevel() << " " << RemoveSpaces(itr->GetName()) << " " << itr->GetWealth() << " " << itr->GetX() << " " << itr->GetY() << " " << itr->MapTextureFileName << " " << itr->Combat << endl; } File.close(); File.open(PathToMap + "RandomEncounters.txt"); File.clear(); for(auto itr = RandomEncounters.begin(); itr != RandomEncounters.end(); ++itr) { File << itr->ID << " " << itr->GetAttack() << " " << itr->GetDefense() << " " << itr->GetHealth() << " " << itr->GetLevel() << " " << RemoveSpaces(itr->GetName()) << " " << itr->GetWealth() << " " << itr->Combat << endl; } File.close(); File.open(PathToMap + "QuestGivers.txt"); File.clear(); for(auto itr = QuestGivers.begin(); itr != QuestGivers.end(); ++itr) { File << itr->ID << " " << itr->x << " " << itr->y << " " << itr->TextureFileName << " " << itr->Quests.size(); for(auto iitr = itr->Quests.begin(); iitr != itr->Quests.end(); ++iitr) { File << " " << iitr->ID; } File << endl; } File.close(); }
// // Evaluate the enemy defense which is threatened // U32 Map::Cluster::EvaluateDefense(Team *team, Relation relation, U32 *threats) { U32 defense = 0; // Enumerate the enemy teams for (List<Team>::Iterator t(&team->RelatedTeams(relation)); *t; ++t) { for (U32 a = 0; a < ArmourClass::NumClasses(); a++) { if (threats[a]) { defense += GetDefense((*t)->GetId(), a); } } } return (defense); }
//Set Monster Stats Values bool CMonster::SetStats(bool all) { if(thisnpc == NULL) return false; Stats->Level = thisnpc->level; Stats->Attack_Power = GetAttackPower( ); Stats->Defense = GetDefense( ); Stats->xprate = GetXPRate( ); Stats->itemdroprate = GetItemDropRate( ); Stats->zulydroprate = GetZulyDropRate( ); Stats->Attack_Speed = GetAttackSpeed( ); Stats->Move_Speed = GetMoveSpeed( ); Stats->Dodge = GetDodge( ); Stats->Accury = GetAccury( ); Stats->Critical = GetCritical( ); Stats->Magic_Defense = GetMagicDefense( ); Stats->magicattack = GetMagicAttack( ); Stats->Attack_Distance = GetAttackDistance( ); for(int i=0;i<20;i++) { AIVar[i] = 0; } return true; }
//Set Monster Stats Values bool CMonster::SetStats(bool all) { if(thisnpc == NULL) return false; Stats->Attack_Power = GetAttackPower( ); Stats->Defense = GetDefense( ); Stats->xprate = GetXPRate( ); Stats->itemdroprate = GetItemDropRate( ); //Stats->zulydroprate = GetZulyDropRate( ); //PY: pointless stat. It's always zero. Use thisnpc->money to get the value directly from the STB Stats->Attack_Speed = GetAttackSpeed( ); Stats->Move_Speed = GetMoveSpeed( ); Stats->Dodge = GetDodge( ); Stats->Accury = GetAccury( ); Stats->Critical = GetCritical( ); Stats->Magic_Defense = GetMagicDefense( ); Stats->magicattack = GetMagicAttack( ); Stats->Attack_Distance = GetAttackDistance( ); for(int i=0;i<20;i++) { AIVar[i] = 0; } return true; }
// set monster stats values bool CMonster::SetStats() { if(thisnpc == NULL) { return false; } Stats->Level = thisnpc->level; Stats->Attack_Power = GetAttackPower( ); Stats->Defense = GetDefense( ); Stats->Attack_Speed = GetAttackSpeed( ); Stats->Move_Speed = GetMoveSpeed( ); Stats->Dodge = GetDodge( ); Stats->Accury = GetAccury( ); Stats->Critical = GetCritical( ); Stats->Magic_Defense = GetMagicDefense( ); Stats->magicattack = GetMagicAttack( ); Stats->Attack_Distance = GetAttackDistance( ); //Stats->MaxHP = GetMaxHP( ); //Stats->HP = Stats->MaxHP; //Stats->MaxMP = GetMaxMP( ); //Stats->MP = Stats->MaxMP; return true; }
// Check For Debuffs void CCharacter::RefreshBuff( ) { bool bflag = false; for( UINT i=0; i<30; i++) { if(MagicStatus[i].Buff==0) continue; clock_t etime = clock() - MagicStatus[i].BuffTime; if( etime >= MagicStatus[i].Duration * CLOCKS_PER_SEC ) { switch(MagicStatus[i].Buff) { case A_ATTACK: if(i<15) Status->Attack_up = 0xff; else Status->Attack_down = 0xff; Stats->Attack_Power = GetAttackPower( ); break; case A_DEFENSE: if(i<15) Status->Defense_up= 0xff; else Status->Defense_down = 0xff; Stats->Defense = GetDefense( ); break; case A_ACCUR: if(i<15) Status->Accury_up= 0xff; else Status->Accury_down = 0xff; Stats->Accury = GetAccury( ); break; case A_MRESIST: if(i<15) Status->Magic_Defense_up = 0xff; else Status->Magic_Defense_down = 0xff; Stats->Magic_Defense = GetMagicDefense( ); break; case A_DODGE: if(i<15) Status->Dodge_up = 0xff; else Status->Dodge_down = 0xff; Stats->Dodge = GetDodge( ); break; case A_DASH: if(i<15) Status->Dash_up = 0xff; else Status->Dash_down = 0xff; Stats->Move_Speed = GetMoveSpeed( ); break; case A_HASTE: if(i < 15) { Status->Haste_up = 0xff; } else { Status->Haste_down = 0xff; } Stats->Attack_Speed = GetAttackSpeed(); break; case A_CRITICAL: if(i<15) Status->Critical_up = 0xff; else Status->Critical_down = 0xff; Stats->Critical = GetCritical( ); break; case A_MAX_HP: if(i<15) Status->HP_up = 0xff; else Status->HP_down = 0xff; Stats->MaxHP = GetMaxHP( ); break; case A_MAX_MP: if(i<15) Status->MP_up = 0xff; else Status->MP_down = 0xff; Stats->MaxMP = GetMaxMP( ); break; case A_STUN: Status->Stuned = 0xff; printf("removing stun\n"); //StartAction2(NULL, 0, 0, true); break; case A_POISON: Status->Poisoned = 0xff; printf("removing poison\n"); break; case A_MUTE: Status->Muted = 0xff; break; case A_GMExtra_Damage: case A_Extra_Damage: if(i<15) { Status->ExtraDamage_up = 0xff; Stats->ExtraDamage = 0; } else Status->ExtraDamage_down = 0xff; break; } MagicStatus[i].Buff = 0; MagicStatus[i].BuffTime = 0; MagicStatus[i].Duration = 0; MagicStatus[i].Value = 0; bflag = true; } else if (MagicStatus[i].Buff == A_POISON && etime > 1*CLOCKS_PER_SEC) //Do poison dmg every 1.5 seconds { Stats->HP -= MagicStatus[i].Value; MagicStatus[i].BuffTime+= 1*CLOCKS_PER_SEC; MagicStatus[i].Duration-=1; printf("did %i poison dmg to the player, still %i seconds and %i HP remain \n", MagicStatus[i].Value, MagicStatus[i].Duration, Stats->HP); //A bunch of messy code to send dmg packet BEGINPACKET( pak, 0x7b6 ); ADDWORD ( pak, clientid ); ADDWORD ( pak, 0 ); ADDDWORD ( pak, 0x000007f8 ); ADDBYTE ( pak, 0x00 ); ADDDWORD ( pak, MagicStatus[i].Value ); //If Enemy is killed if( IsDead()) { printf("char died\n"); CDrop* thisdrop = NULL; //ADDDWORD ( pak, 16 );//i don't think this one belongs in irose if( !IsSummon( ) && !IsPlayer( )) { thisdrop = GetDrop( ); if( thisdrop!=NULL) { ADDFLOAT ( pak, thisdrop->pos.x*100 ); ADDFLOAT ( pak, thisdrop->pos.y*100 ); if( thisdrop->type==1) { ADDDWORD( pak, 0xccdf );//0xccccccdf ); ADDDWORD( pak, thisdrop->amount ); } else { ADDDWORD ( pak, GServer->BuildItemHead( thisdrop->item ) ); ADDDWORD ( pak, GServer->BuildItemData( thisdrop->item ) ); } ADDWORD ( pak, thisdrop->clientid ); ADDWORD ( pak, thisdrop->owner ); CMap* map = GServer->MapList.Index[thisdrop->posMap]; map->AddDrop( thisdrop ); } } GServer->SendToVisible( &pak, this, thisdrop ); } //If enemy is still alive else { ADDDWORD ( pak, 4 ); GServer->SendToVisible( &pak, this ); } } } if(bflag) { BEGINPACKET( pak,0x7b7 ); ADDWORD ( pak, clientid ); ADDDWORD ( pak, GServer->BuildBuffs( this ) ); GServer->SendToVisible( &pak, this ); } }
void CCharacter::RefreshBuff( ) { bool bflag = false; for( UINT i=0;i<32;i++) { if(MagicStatus[i].Buff == 0) continue; clock_t etime = clock() - MagicStatus[i].BuffTime; if( etime >= MagicStatus[i].Duration * CLOCKS_PER_SEC ) { Log(MSG_INFO,"Magic Status %i, vanish after: %i", MagicStatus[i].Status, MagicStatus[i].Duration); switch(MagicStatus[i].Status) { case STATUS_HP_8: case STATUS_HP_18: case STATUS_HP_30: case STATUS_HP_43: case STATUS_HP_58: case STATUS_HP_75: case STATUS_SUMMON_HP: case STATUS_HP_92: case STATUS_HP_111: case STATUS_HP_131: case STATUS_HP_152: case STATUS_HP_174: case STATUS_HP_197: case STATUS_HP_221: case STATUS_HP_246: case STATUS_HP_272: case STATUS_HP_299: case STATUS_HP_326: case STATUS_HP_354: case STATUS_HP_383: case STATUS_HP_413: case STATUS_HP_443: case STATUS_HP_475: case STATUS_HP_539: case STATUS_HP_572: case STATUS_HP_5_PC: case 115: { Status->HPHeal = 0xff; } break; case STATUS_MP_6: case STATUS_MP_10: case STATUS_MP_14: case STATUS_MP_18: case STATUS_MP_21: case STATUS_MP_25: case STATUS_MP_29: case STATUS_MP_33: case STATUS_MP_36: case STATUS_MP_40: case STATUS_MP_44: case STATUS_MP_48: case STATUS_MP_51: case STATUS_MP_55: case STATUS_MP_59: case STATUS_MP_63: case STATUS_MP_66: case STATUS_MP_70: case STATUS_MP_74: case STATUS_MP_78: case STATUS_MP_81: case STATUS_MP_85: case STATUS_MP_89: case STATUS_MP_93: case STATUS_MP_96: case 116: { Status->MPHeal = 0xff; } break; case 18: // attack power up case 19: // attack power down case 48: // attack power up { if(i == BUFF_ATTACK_UP_POS) { Status->Attack_up = 0xff; } else { Status->Attack_down = 0xff; } Stats->Attack_Power = GetAttackPower( ); } break; case 20: // def up case 21: // def down case 49: // def up { if(i==BUFF_DEFENSE_UP_POS) { Status->Defense_up= 0xff; } else { Status->Defense_down = 0xff; } Stats->Defense = GetDefense( ); } break; case 24: //Accuracy up case 25: //Accuracy down case 51: //attack Accuracy up. { if(i==BUFF_HITRATE_UP_POS) { Status->Accuracy_up= 0xff; } else { Status->Accuracy_down = 0xff; } Stats->Accuracy = GetAccuracy( ); } break; case 22: // macic resistance up case 23: // magic resistance down case 50: // magic resistance up { if(i==BUFF_MDEFENSE_UP_POS) { Status->Magic_Defense_up = 0xff; } else { Status->Magic_Defense_down = 0xff; } Stats->Magic_Defense = GetMagicDefense( ); } break; case 28: //dodge up case 29: //dodge down case 53: //dodge rate up { if(i==BUFF_DODGE_UP_POS) { Status->Dodge_up = 0xff; } else { Status->Dodge_down = 0xff; } Stats->Dodge = GetDodge( ); } break; case 14: //dash case 15: //slow case 46: //movement speed increased { if(i==BUFF_DASH_UP_POS) { Status->Dash_up = 0xff; } else { Status->Dash_down = 0xff; } Stats->Move_Speed = GetMoveSpeed( ); } break; case 16: // haste attack case 17: // slow attack case 47: // attack speed up { if(i==BUFF_HASTE_UP_POS) { Status->Haste_up = 0xff; } else { Status->Haste_down = 0xff; } //Stats->Attack_Speed_Percent = GetAttackSpeedPercent( ); } break; case 26: // crit up case 27: // crit down case 52: // crit up { if(i==BUFF_CRITICAL_UP_POS) { Status->Critical_up = 0xff; } else { Status->Critical_down = 0xff; } Stats->Critical = GetCritical( ); } break; case 12: // max HP up case 44: // max HP up { if(i==BUFF_MAX_HP_POS) { Status->HP_up = 0xff; } else { Status->HP_down = 0xff; } Stats->MaxHP = GetMaxHP( ); if(Stats->HP > Stats->MaxHP) { Stats->HP = Stats->MaxHP; } } break; case 13: // max MP up case 45: // max MP up { if(i==BUFF_MAX_MP_POS) { Status->MP_up = 0xff; } else { Status->MP_down = 0xff; } Stats->MaxMP = GetMaxMP( ); if(Stats->MP > Stats->MaxMP) { Stats->MP = Stats->MaxMP; } } break; case 32: // faint { Status->Faint = 0xff; Status->CanMove = true; Status->CanCastSkill = true; Status->CanAttack = true; //printf("removing stun\n"); } break; case 7: case 8: case 9: case 10: case 11: case 89: //poisoned { Status->Poisoned = 0xff; //printf("removing poison\n"); } break; case 30: // muted { Status->Muted = 0xff; Status->CanCastSkill = true; } break; case 31: // sleep May need to be fixed later to accomodate multiple status effects. { Status->Sleep = 0xff; Status->CanMove = true; Status->CanCastSkill = true; Status->CanAttack = true; } break; case 36: //A_Extra_Damage: case 54: //A_GMExtra_Damage: case 83: //Valkyrie Charm: { if(i==BUFF_DUMMY_DAMAGE_POS) { Status->ExtraDamage_up = 0xff; Stats->ExtraDamage_add = 0;//We put extardamage add value to 0 if we lost the adddmg buff } else { Status->ExtraDamage_down = 0xff; Stats->ExtraDamage_add = 0;//We put extardamage add value to 0 if we lost the adddmg buff } } break; case 56: //Taunt { Status->Taunt = 0xff; //printf("removing Taunt\n"); } break; case 58: case 61: case 74: case 77: case 78: case 79: case 80: //flame { Status->Flamed = 0xff; } break; case 33://Stealth,Camoflauge { if(IsAttacking( )) { MagicStatus[i].Duration = 0; } Status->Stealth = 0xff; //printf("removing Stealth\n"); } break; case 86://Stealth,Weary { Status->Weary = 0xff; Status->CanCastSkill = true; //printf("removing Weary\n"); } break; case 34://Cloaking { Status->Cloaking = 0xff; //printf("removing Cloaking\n"); } break; case 35: //ShieldDamage: { if(i==BUFF_SHIELD_DAMAGE_POS) { Status->ShieldDamage_up = 0xff; //Stats->ShieldDamage = 0xff; } else { Status->ShieldDamage_down = 0xff; //Stats->ShieldDamage = 0xff; } } break; case 55://Detect { Status->Detect = 0xff; Status->Cloaking = 0xff; Status->Stealth = 0xff; //printf("Detect Done\n"); } break; case 38://Purify { //Buff_Down Status->Attack_down = 0xff; Status->Defense_down = 0xff; Status->Accuracy_down = 0xff; Status->Magic_Defense_down = 0xff; Status->Dodge_down = 0xff; Status->Dash_down = 0xff; Status->Haste_down = 0xff; Status->Critical_down = 0xff; Status->HP_down = 0xff; Status->MP_down = 0xff; Status->ExtraDamage_down = 0xff; Status->ShieldDamage_down = 0xff; Status->ALL_down = 0xff; //Bad Status //Status->Stun = 0xff; Status->Poisoned = 0xff; Status->Muted = 0xff; Status->Sleep = 0xff; Status->Flamed = 0xff; Status->Faint = 0xff; //Stats Stats->Attack_Power = GetAttackPower( ); Stats->Defense = GetDefense( ); Stats->Accuracy = GetAccuracy( ); Stats->Magic_Defense = GetMagicDefense( ); Stats->Dodge = GetDodge( ); Stats->Move_Speed = GetMoveSpeed( ); Stats->Attack_Speed = GetAttackSpeed( ); //Stats->Attack_Speed_Percent = GetAttackSpeedPercent(); Stats->Critical = GetCritical( ); Stats->MaxHP = GetMaxHP( ); Stats->MaxMP = GetMaxMP( ); //printf("Purify Done\n"); } break; case 39:// Dispell { //Buff_Down Status->Attack_down = 0xff; Status->Defense_down = 0xff; Status->Accuracy_down = 0xff; Status->Magic_Defense_down = 0xff; Status->Dodge_down = 0xff; Status->Dash_down = 0xff; Status->Haste_down = 0xff; Status->Critical_down = 0xff; Status->HP_down = 0xff; Status->MP_down = 0xff; Status->ExtraDamage_down = 0xff; Status->ShieldDamage_down = 0xff; Status->ALL_down = 0xff; //Buff_Up Status->Attack_up = 0xff; Status->Defense_up = 0xff; Status->Accuracy_up = 0xff; Status->Magic_Defense_up = 0xff; Status->Dodge_up = 0xff; Status->Dash_up = 0xff; Status->Haste_up = 0xff; Status->Critical_up = 0xff; Status->HP_up = 0xff; Status->MP_up = 0xff; Status->ExtraDamage_up = 0xff; Status->ShieldDamage_up = 0xff; Status->ALL_up = 0xff; //Bad Status //Status->Stun = 0xff; Status->Poisoned = 0xff; Status->Muted = 0xff; Status->Sleep = 0xff; Status->Flamed = 0xff; Status->Faint = 0xff; //Stats Stats->Attack_Power = GetAttackPower( ); Stats->Defense = GetDefense( ); Stats->Accuracy = GetAccuracy( ); Stats->Magic_Defense = GetMagicDefense( ); Stats->Dodge = GetDodge( ); Stats->Move_Speed = GetMoveSpeed( ); Stats->Attack_Speed = GetAttackSpeed( ); Stats->Critical = GetCritical( ); Stats->MaxHP = GetMaxHP( ); Stats->MaxMP = GetMaxMP( ); //printf("Dispell Done\n"); } break; default: { Log(MSG_WARNING,"Unknow skill status in charfunctions %u.",MagicStatus[i].Status); } } BEGINPACKET( pak,0x7b7 ); ADDWORD ( pak, clientid ); ADDDWORD ( pak, GServer->BuildBuffs( this ) ); GServer->SendToVisible( &pak, this ); MagicStatus[i].Status = 0; MagicStatus[i].Buff = 0; MagicStatus[i].BuffTime = 0; MagicStatus[i].Duration = 0; MagicStatus[i].Value = 0; bflag = true; } else if ( ((MagicStatus[i].Status >= 7 && MagicStatus[i].Status <= 11) || MagicStatus[i].Status == 89) && etime > 1*CLOCKS_PER_SEC) //Do poison dmg every 1.5 seconds { Stats->HP -= MagicStatus[i].Status; //Actually take 7, 8, 9, 10 or 11 from the health. Based on the Status itself, LMA: can be 89 noc too. MagicStatus[i].BuffTime += 1*CLOCKS_PER_SEC; MagicStatus[i].Duration -= 1; //printf("did %i poison dmg to the player, still %i seconds and %i HP remain \n", MagicStatus[i].Status, MagicStatus[i].Duration, Stats->HP); //Log(MSG_WARNING,"did %i poison dmg to the player / monster, still %i seconds and %I64i HP remain", MagicStatus[i].Status, MagicStatus[i].Duration, Stats->HP); //LMA: If dead, let's the client resynch if(IsDead()) { BEGINPACKET( pak, 0x79f ); ADDWORD ( pak, clientid ); ADDDWORD ( pak, 1); GServer->SendToVisible( &pak, this ); Log(MSG_INFO,"death poison for %i, amount: %i",clientid,MagicStatus[i].Status); } //A bunch of messy code to send dmg packet BEGINPACKET( pak, 0x7b6 ); ADDWORD ( pak, clientid ); ADDWORD ( pak, 0 ); ADDDWORD ( pak, 0x000007f8 ); ADDBYTE ( pak, 0x00 ); ADDDWORD ( pak, MagicStatus[i].Status ); //If Enemy is killed if( IsDead()) { //printf("char died\n"); CDrop* thisdrop = NULL; ADDDWORD ( pak, 16 ); if( !IsSummon( ) && !IsPlayer( )) { //LMA: No drop if already dead and drop done. if(drop_dead) { Log(MSG_WARNING,"Trying to make a monster (CID %u, type %u) drop again but already did.",clientid,char_montype); } else { thisdrop = GetDrop( ); if( thisdrop!=NULL) { CMap* map = GServer->MapList.Index[thisdrop->posMap]; map->AddDrop( thisdrop ); } } } //GServer->SendToVisible( &pak, this, thisdrop ); GServer->SendToVisible( &pak, this); } else { //If enemy is still alive ADDDWORD ( pak, 4 ); GServer->SendToVisible( &pak, this ); } } else if ( MagicStatus[i].Status == 58 || MagicStatus[i].Status == 61 || MagicStatus[i].Status == 71 || MagicStatus[i].Status >= 77 && MagicStatus[i].Status <= 80 || MagicStatus[i].Status == 88 && etime > 1*CLOCKS_PER_SEC) //Do flame dmg every 1.5 seconds { Stats->HP -= MagicStatus[i].Status; MagicStatus[i].BuffTime += 1*CLOCKS_PER_SEC; MagicStatus[i].Duration -= 1; printf("did %i flame dmg to the player, still %i seconds and %i HP remain \n", MagicStatus[i].Status, MagicStatus[i].Duration, Stats->HP); //LMA: If dead, let's the client resynch if(IsDead()) { BEGINPACKET( pak, 0x79f ); ADDWORD ( pak, clientid ); ADDDWORD ( pak, 1); GServer->SendToVisible( &pak, this ); Log(MSG_INFO,"death flame for %i, amount: %i",clientid,MagicStatus[i].Status); } //A bunch of messy code to send dmg packet BEGINPACKET( pak, 0x7b6 ); ADDWORD ( pak, clientid ); ADDWORD ( pak, 0 ); ADDDWORD ( pak, 0x000007f8 ); ADDBYTE ( pak, 0x00 ); ADDDWORD ( pak, MagicStatus[i].Status ); //If Enemy is killed if( IsDead()) { //printf("char died\n"); CDrop* thisdrop = NULL; ADDDWORD ( pak, 16 ); if( !IsSummon( ) && !IsPlayer( )) { //LMA: No drop if already dead and drop done. if(drop_dead) { Log(MSG_WARNING,"Trying to make a monster (CID %u, type %u) drop again but already did.",clientid,char_montype); } else { thisdrop = GetDrop( ); if( thisdrop!=NULL) { CMap* map = GServer->MapList.Index[thisdrop->posMap]; map->AddDrop( thisdrop ); } } } //GServer->SendToVisible( &pak, this, thisdrop ); GServer->SendToVisible( &pak, this); } else { //If enemy is still alive ADDDWORD ( pak, 4 ); GServer->SendToVisible( &pak, this ); } } } for( UINT i=0;i<32;i++) { if(MagicStatus2[i].Buff == 0) continue; clock_t etime = clock() - MagicStatus2[i].BuffTime; if( etime >= MagicStatus2[i].Duration * CLOCKS_PER_SEC ) { CPlayer* thisplayer = GServer->GetClientByID(clientid); Log(MSG_INFO,"Magic Status %i, vanish after: %i", MagicStatus2[i].Status, MagicStatus2[i].Duration); switch(MagicStatus2[i].Status) { case 126: // ALLbuff up { if(i == BUFF_ATTACK_UP_POS) { Status->Attack_up = 0xff; thisplayer->Attr->ALLbuff = 0; } else { Status->Attack_down = 0xff; thisplayer->Attr->ALLbuff = 0; } } default: { Log(MSG_WARNING,"Unknow skill status in charfunctions %u.",MagicStatus[i].Status); } } BEGINPACKET( pak,0x7b7 ); ADDWORD ( pak, clientid ); ADDDWORD ( pak, GServer->BuildBuffs( this ) ); GServer->SendToVisible( &pak, this ); MagicStatus2[i].Status = 0; MagicStatus2[i].Buff = 0; MagicStatus2[i].BuffTime = 0; MagicStatus2[i].Duration = 0; MagicStatus2[i].Value = 0; } } // if(bflag) // { // BEGINPACKET( pak,0x7b7 ); // ADDWORD ( pak, clientid ); // ADDDWORD ( pak, GServer->BuildBuffs( this ) ); // GServer->SendToVisible( &pak, this ); // } }
/* readonly: false, fade: false */ Dialog::answer_t Heroes::OpenDialog(bool readonly, bool fade) { if(Settings::Get().QVGA()) return PocketPC::HeroesOpenDialog(*this, readonly); Display & display = Display::Get(); Cursor & cursor = Cursor::Get(); cursor.Hide(); cursor.SetThemes(cursor.POINTER); Dialog::FrameBorder background; background.SetPosition((display.w() - 640 - BORDERWIDTH * 2) / 2, (display.h() - 480 - BORDERWIDTH * 2) / 2, 640, 480); background.Redraw(); const Point cur_pt(background.GetArea().x, background.GetArea().y); Point dst_pt(cur_pt); // fade if(fade && Settings::Get().ExtGameUseFade()) display.Fade(); display.FillRect(0, 0, 0, Rect(dst_pt, 640, 480)); AGG::GetICN(ICN::HEROBKG, 0).Blit(dst_pt); AGG::GetICN(Settings::Get().ExtGameEvilInterface() ? ICN::HEROEXTE : ICN::HEROEXTG, 0).Blit(dst_pt); std::string message; // portrait dst_pt.x = cur_pt.x + 49; dst_pt.y = cur_pt.y + 31; GetPortrait101x93().Blit(dst_pt, display); // name message = _("%{name} the %{race} ( Level %{level} )"); String::Replace(message, "%{name}", name); String::Replace(message, "%{race}", Race::String(race)); String::Replace(message, "%{level}", GetLevel()); Text text(message, Font::BIG); text.Blit(cur_pt.x + 320 - text.w() / 2, cur_pt.y + 1); // attack text.Set(_("Attack Skill"), Font::SMALL); dst_pt.x = cur_pt.x + 196; dst_pt.y = cur_pt.y + 34; text.Blit(dst_pt.x - text.w() / 2, dst_pt.y); text.Set(GetString(GetAttack()), Font::BIG); dst_pt.y += 70; text.Blit(dst_pt.x - text.w() / 2, dst_pt.y); const Rect rectAttackSkill(cur_pt.x + 156, cur_pt.y + 30, 80, 92); std::string attackDescription(_("Your attack skill is a bonus added to each creature's attack skill.")); message.clear(); GetAttack(&message); if(message.size()) { attackDescription.append("\n \n"); attackDescription.append(_("Current Modifiers:")); attackDescription.append("\n \n"); attackDescription.append(message); } // defense dst_pt.x = cur_pt.x + 284; dst_pt.y = cur_pt.y + 34; text.Set(_("Defense Skill"), Font::SMALL); text.Blit(dst_pt.x - text.w() / 2, dst_pt.y); dst_pt.y += 70; text.Set(GetString(GetDefense()), Font::BIG); text.Blit(dst_pt.x - text.w() / 2, dst_pt.y); const Rect rectDefenseSkill(cur_pt.x + 156 + 88, cur_pt.y + 30, 80, 92); std::string defenseDescription(_("Your defense skill is a bonus added to each creature's defense skill.")); message.clear(); GetDefense(&message); if(message.size()) { defenseDescription.append("\n \n"); defenseDescription.append(_("Current Modifiers:")); defenseDescription.append("\n \n"); defenseDescription.append(message); } // spell dst_pt.x = cur_pt.x + 372; dst_pt.y = cur_pt.y + 34; text.Set(_("Spell Power"), Font::SMALL); text.Blit(dst_pt.x - text.w() / 2, dst_pt.y); dst_pt.y += 70; text.Set(GetString(GetPower()), Font::BIG); text.Blit(dst_pt.x - text.w() / 2, dst_pt.y); const Rect rectSpellSkill(cur_pt.x + 156 + 2 * 88, cur_pt.y + 30, 80, 92); std::string powerDescription(_("Your spell power determines the length or power of a spell.")); message.clear(); GetPower(&message); if(message.size()) { powerDescription.append("\n \n"); powerDescription.append(_("Current Modifiers:")); powerDescription.append("\n \n"); powerDescription.append(message); } // knowledge dst_pt.x = cur_pt.x + 460; dst_pt.y = cur_pt.y + 34; text.Set(_("Knowledge"), Font::SMALL); text.Blit(dst_pt.x - text.w() / 2, dst_pt.y); dst_pt.y += 70; text.Set(GetString(GetKnowledge()), Font::BIG); text.Blit(dst_pt.x - text.w() / 2, dst_pt.y); const Rect rectKnowledgeSkill(cur_pt.x + 156 + 3 * 88, cur_pt.y + 30, 80, 92); std::string knowledgeDescription(_("Your knowledge determines how many spell points your hero may have. Under normal cirumstances, a hero is limited to 10 spell points per level of knowledge.")); message.clear(); GetKnowledge(&message); if(message.size()) { knowledgeDescription.append("\n \n"); knowledgeDescription.append(_("Current Modifiers:")); knowledgeDescription.append("\n \n"); knowledgeDescription.append(message); } // morale dst_pt.x = cur_pt.x + 514; dst_pt.y = cur_pt.y + 35; MoraleIndicator moraleIndicator(*this); moraleIndicator.SetPos(dst_pt); moraleIndicator.Redraw(); // luck dst_pt.x = cur_pt.x + 552; dst_pt.y = cur_pt.y + 35; LuckIndicator luckIndicator(*this); luckIndicator.SetPos(dst_pt); luckIndicator.Redraw(); // army format spread dst_pt.x = cur_pt.x + 515; dst_pt.y = cur_pt.y + 63; const Sprite & sprite1 = AGG::GetICN(ICN::HSICONS, 9); sprite1.Blit(dst_pt); const Rect rectSpreadArmyFormat(dst_pt, sprite1.w(), sprite1.h()); const std::string descriptionSpreadArmyFormat = _("'Spread' combat formation spreads your armies from the top to the bottom of the battlefield, with at least one empty space between each army."); const Point army1_pt(dst_pt.x - 1, dst_pt.y - 1); // army format grouped dst_pt.x = cur_pt.x + 552; dst_pt.y = cur_pt.y + 63; const Sprite & sprite2 = AGG::GetICN(ICN::HSICONS, 10); sprite2.Blit(dst_pt); const Rect rectGroupedArmyFormat(dst_pt, sprite2.w(), sprite2.h()); const std::string descriptionGroupedArmyFormat = _("'Grouped' combat formation bunches your army together in the center of your side of the battlefield."); const Point army2_pt(dst_pt.x - 1, dst_pt.y - 1); // cursor format SpriteCursor cursorFormat(AGG::GetICN(ICN::HSICONS, 11), Army::FORMAT_SPREAD == army.GetCombatFormat() ? army1_pt : army2_pt); cursorFormat.Show(Army::FORMAT_SPREAD == army.GetCombatFormat() ? army1_pt : army2_pt); // experience ExperienceIndicator experienceInfo(*this); experienceInfo.SetPos(Point(cur_pt.x + 514, cur_pt.y + 85)); experienceInfo.Redraw(); // spell points SpellPointsIndicator spellPointsInfo(*this); spellPointsInfo.SetPos(Point(cur_pt.x + 549, cur_pt.y + 87)); spellPointsInfo.Redraw(); // crest dst_pt.x = cur_pt.x + 49; dst_pt.y = cur_pt.y + 130; AGG::GetICN(ICN::CREST, Color::NONE == color ? Color::GetIndex(Settings::Get().CurrentColor()) : Color::GetIndex(color)).Blit(dst_pt); // monster dst_pt.x = cur_pt.x + 156; dst_pt.y = cur_pt.y + 130; SelectArmyBar selectArmy; selectArmy.SetArmy(army); selectArmy.SetPos(dst_pt); selectArmy.SetInterval(6); selectArmy.SetBackgroundSprite(AGG::GetICN(ICN::STRIP, 2)); selectArmy.SetCursorSprite(AGG::GetICN(ICN::STRIP, 1)); selectArmy.SetSaveLastTroop(); if(readonly) selectArmy.SetReadOnly(); const Castle* castle = inCastle(); if(castle) selectArmy.SetCastle(*castle); selectArmy.Redraw(); // secskill SecondarySkillBar secskill_bar; secskill_bar.SetPos(cur_pt.x + 3, cur_pt.y + 233); secskill_bar.SetInterval(5); secskill_bar.SetSkills(secondary_skills); secskill_bar.Redraw(); dst_pt.x = cur_pt.x + 51; dst_pt.y = cur_pt.y + 308; SelectArtifactsBar selectArtifacts(*this); selectArtifacts.SetPos(dst_pt); selectArtifacts.SetInterval(15); selectArtifacts.SetBackgroundSprite(AGG::GetICN(ICN::ARTIFACT, 0)); selectArtifacts.SetCursorSprite(AGG::GetICN(ICN::NGEXTRA, 62)); if(readonly) selectArtifacts.SetReadOnly(); selectArtifacts.Redraw(); // bottom small bar dst_pt.x = cur_pt.x + 22; dst_pt.y = cur_pt.y + 460; const Sprite & bar = AGG::GetICN(ICN::HSBTNS, 8); bar.Blit(dst_pt); StatusBar statusBar; statusBar.SetCenter(dst_pt.x + bar.w() / 2, dst_pt.y + 11); // button prev dst_pt.x = cur_pt.x + 1; dst_pt.y = cur_pt.y + 480 - 20; Button buttonPrevHero(dst_pt, ICN::HSBTNS, 4, 5); // button next dst_pt.x = cur_pt.x + 640 - 23; dst_pt.y = cur_pt.y + 480 - 20; Button buttonNextHero(dst_pt, ICN::HSBTNS, 6, 7); // button dismiss dst_pt.x = cur_pt.x + 5; dst_pt.y = cur_pt.y + 318; Button buttonDismiss(dst_pt, ICN::HSBTNS, 0, 1); // button exit dst_pt.x = cur_pt.x + 603; dst_pt.y = cur_pt.y + 318; Button buttonExit(dst_pt, ICN::HSBTNS, 2, 3); LocalEvent & le = LocalEvent::Get(); if(castle || readonly || Modes(NOTDISMISS)) { buttonDismiss.Press(); buttonDismiss.SetDisable(true); } if(readonly || 2 > world.GetKingdom(GetColor()).GetHeroes().size()) { buttonNextHero.Press(); buttonPrevHero.Press(); buttonNextHero.SetDisable(true); buttonPrevHero.SetDisable(true); } buttonPrevHero.Draw(); buttonNextHero.Draw(); buttonDismiss.Draw(); buttonExit.Draw(); cursor.Show(); display.Flip(); bool redrawMorale = false; bool redrawLuck = false; // dialog menu loop while(le.HandleEvents()) { if(redrawMorale) { cursor.Hide(); moraleIndicator.Redraw(); cursor.Show(); display.Flip(); redrawMorale = false; } if(redrawLuck) { cursor.Hide(); luckIndicator.Redraw(); cursor.Show(); display.Flip(); redrawLuck = false; } // exit if(le.MouseClickLeft(buttonExit) || Game::HotKeyPress(Game::EVENT_DEFAULT_EXIT)) return Dialog::CANCEL; // heroes troops if(le.MouseCursor(selectArmy.GetArea())) { if(SelectArmyBar::QueueEventProcessing(selectArmy)) { redrawMorale = true; redrawLuck = true; } } if(le.MouseCursor(selectArtifacts.GetArea())) { SelectArtifactsBar::QueueEventProcessing(selectArtifacts); { redrawMorale = true; redrawLuck = true; } } // button click le.MousePressLeft(buttonExit) ? buttonExit.PressDraw() : buttonExit.ReleaseDraw(); if(buttonDismiss.isEnable()) le.MousePressLeft(buttonDismiss) ? buttonDismiss.PressDraw() : buttonDismiss.ReleaseDraw(); if(buttonPrevHero.isEnable()) le.MousePressLeft(buttonPrevHero) ? buttonPrevHero.PressDraw() : buttonPrevHero.ReleaseDraw(); if(buttonNextHero.isEnable()) le.MousePressLeft(buttonNextHero) ? buttonNextHero.PressDraw() : buttonNextHero.ReleaseDraw(); // prev hero if(buttonPrevHero.isEnable() && le.MouseClickLeft(buttonPrevHero)){ return Dialog::PREV; } // next hero if(buttonNextHero.isEnable() && le.MouseClickLeft(buttonNextHero)){ return Dialog::NEXT; } // dismiss if(buttonDismiss.isEnable() && le.MouseClickLeft(buttonDismiss) && Dialog::YES == Dialog::Message(GetName(), _("Are you sure you want to dismiss this Hero?"), Font::BIG, Dialog::YES | Dialog::NO)) { return Dialog::DISMISS; } if(le.MouseCursor(moraleIndicator.GetArea())) MoraleIndicator::QueueEventProcessing(moraleIndicator); else if(le.MouseCursor(luckIndicator.GetArea())) LuckIndicator::QueueEventProcessing(luckIndicator); else if(le.MouseCursor(experienceInfo.GetArea())) experienceInfo.QueueEventProcessing(); else if(le.MouseCursor(spellPointsInfo.GetArea())) spellPointsInfo.QueueEventProcessing(); // left click info if(le.MouseClickLeft(rectAttackSkill)) Dialog::Message(_("Attack Skill"), attackDescription, Font::BIG, Dialog::OK); else if(le.MouseClickLeft(rectDefenseSkill)) Dialog::Message(_("Defense Skill"), defenseDescription, Font::BIG, Dialog::OK); else if(le.MouseClickLeft(rectSpellSkill)) Dialog::Message(_("Spell Power"), powerDescription, Font::BIG, Dialog::OK); else if(le.MouseClickLeft(rectKnowledgeSkill)) Dialog::Message(_("Knowledge"), knowledgeDescription, Font::BIG, Dialog::OK); else if(!readonly && le.MouseClickLeft(rectSpreadArmyFormat) && Army::FORMAT_SPREAD != army.GetCombatFormat()) { cursor.Hide(); cursorFormat.Move(army1_pt); cursor.Show(); display.Flip(); army.SetCombatFormat(Army::FORMAT_SPREAD); #ifdef WITH_NET FH2LocalClient::SendArmyCombatFormation(army); #endif } else if(!readonly && le.MouseClickLeft(rectGroupedArmyFormat) && Army::FORMAT_SPREAD == army.GetCombatFormat()) { cursor.Hide(); cursorFormat.Move(army2_pt); cursor.Show(); display.Flip(); army.SetCombatFormat(Army::FORMAT_GROUPED); #ifdef WITH_NET FH2LocalClient::SendArmyCombatFormation(army); #endif } if(le.MouseCursor(secskill_bar.GetArea())) secskill_bar.QueueEventProcessing(); // right info if(le.MousePressRight(rectAttackSkill)) Dialog::Message(_("Attack Skill"), attackDescription, Font::BIG); else if(le.MousePressRight(rectDefenseSkill)) Dialog::Message(_("Defense Skill"), defenseDescription, Font::BIG); else if(le.MousePressRight(rectSpellSkill)) Dialog::Message(_("Spell Power"), powerDescription, Font::BIG); else if(le.MousePressRight(rectKnowledgeSkill)) Dialog::Message(_("Knowledge"), knowledgeDescription, Font::BIG); else if(le.MousePressRight(rectSpreadArmyFormat)) Dialog::Message(_("Spread Formation"), descriptionSpreadArmyFormat, Font::BIG); else if(le.MousePressRight(rectGroupedArmyFormat)) Dialog::Message(_("Grouped Formation"), descriptionGroupedArmyFormat, Font::BIG); // status message if(le.MouseCursor(rectAttackSkill)) statusBar.ShowMessage(_("View Attack Skill Info")); else if(le.MouseCursor(rectDefenseSkill)) statusBar.ShowMessage(_("View Defense Skill Info")); else if(le.MouseCursor(rectSpellSkill)) statusBar.ShowMessage(_("View Spell Power Info")); else if(le.MouseCursor(rectKnowledgeSkill)) statusBar.ShowMessage(_("View Knowledge Info")); else if(le.MouseCursor(moraleIndicator.GetArea())) statusBar.ShowMessage(_("View Morale Info")); else if(le.MouseCursor(luckIndicator.GetArea())) statusBar.ShowMessage(_("View Luck Info")); else if(le.MouseCursor(experienceInfo.GetArea())) statusBar.ShowMessage(_("View Experience Info")); else if(le.MouseCursor(spellPointsInfo.GetArea())) statusBar.ShowMessage(_("View Spell Points Info")); else if(le.MouseCursor(rectSpreadArmyFormat)) statusBar.ShowMessage(_("Set army combat formation to 'Spread'")); else if(le.MouseCursor(rectGroupedArmyFormat)) statusBar.ShowMessage(_("Set army combat formation to 'Grouped'")); else if(le.MouseCursor(buttonExit)) statusBar.ShowMessage(_("Exit hero")); else if(le.MouseCursor(buttonDismiss)) { if(Modes(NOTDISMISS)) statusBar.ShowMessage("Dismiss disabled, see game info"); else statusBar.ShowMessage(_("Dismiss hero")); } else if(le.MouseCursor(buttonPrevHero)) statusBar.ShowMessage(_("Show prev heroes")); else if(le.MouseCursor(buttonNextHero)) statusBar.ShowMessage(_("Show next heroes")); else // status message over artifact if(le.MouseCursor(selectArtifacts.GetArea())) { const s8 index = selectArtifacts.GetIndexFromCoord(le.GetMouseCursor()); if(0 <= index && index < HEROESMAXARTIFACT && bag_artifacts[index] != Artifact::UNKNOWN) { message = _("View %{art} Info"); String::Replace(message, "%{art}", bag_artifacts[index].GetName()); statusBar.ShowMessage(message); } else statusBar.ShowMessage(_("Hero Screen")); } else // status message over skill if(le.MouseCursor(secskill_bar.GetArea())) { const u8 ii = secskill_bar.GetIndexFromCoord(le.GetMouseCursor()); if(ii < secondary_skills.size()) { const Skill::Secondary & skill = secondary_skills[ii]; if(skill.isValid()) { message = _("View %{skill} Info"); String::Replace(message, "%{skill}", skill.GetName()); statusBar.ShowMessage(message); } else statusBar.ShowMessage(_("Hero Screen")); } else statusBar.ShowMessage(_("Hero Screen")); } else // status message over troops if(le.MouseCursor(selectArmy.GetArea())) { const s8 index1 = selectArmy.GetIndexFromCoord(le.GetMouseCursor()); if(0 <= index1) { const Army::Troop & troop1 = army.At(index1); const std::string & monster1 = troop1.GetName(); if(selectArmy.isSelected()) { const u8 index2 = selectArmy.Selected(); const Army::Troop & troop2 = army.At(index2); const std::string & monster2 = troop2.GetName(); if(index1 == index2) { message = _("View %{monster}"); String::Replace(message, "%{monster}", monster1); } else if(troop1.isValid() && troop2.isValid()) { message = troop1() == troop2() ? _("Combine %{monster1} armies") : _("Exchange %{monster2} with %{monster1}"); String::Replace(message, "%{monster1}", monster1); String::Replace(message, "%{monster2}", monster2); } else { message = _("Move and right click Redistribute %{monster}"); String::Replace(message, "%{monster}", monster2); } } else if(troop1.isValid()) { message = _("Select %{monster}"); String::Replace(message, "%{monster}", monster1); } else message = _("Empty"); statusBar.ShowMessage(message); } else statusBar.ShowMessage(_("Hero Screen")); } else // clear all statusBar.ShowMessage(_("Hero Screen")); } return Dialog::ZERO; }
// Check For Debuffs void CCharacter::RefreshBuff( ) { bool bflag = false; for( UINT i=0; i<30; i++) { if(MagicStatus[i].Buff == 0) continue; clock_t etime = clock() - MagicStatus[i].BuffTime; if( etime >= MagicStatus[i].Duration * CLOCKS_PER_SEC ) { switch(MagicStatus[i].Status) { case 18: // attack power up case 19: // attack power down case 48: // attack power up if(i<15) Status->Attack_up = 0xff; else Status->Attack_down = 0xff; Stats->Attack_Power = GetAttackPower( ); break; case 20: // def up case 21: // def down case 49: // def up if(i<15) Status->Defense_up= 0xff; else Status->Defense_down = 0xff; Stats->Defense = GetDefense( ); break; case 24: //accuracy up case 25: //accuracy down case 51: //attack accuracy up. if(i<15) Status->Accury_up= 0xff; else Status->Accury_down = 0xff; Stats->Accury = GetAccury( ); break; case 22: // macic resistance up case 23: // magic resistance down case 50: // magic resistance up if(i<15) Status->Magic_Defense_up = 0xff; else Status->Magic_Defense_down = 0xff; Stats->Magic_Defense = GetMagicDefense( ); break; case 28: //dodge up case 29: //dodge down case 53: //dodge rate up if(i<15) Status->Dodge_up = 0xff; else Status->Dodge_down = 0xff; Stats->Dodge = GetDodge( ); break; case 14: //dash case 15: //slow case 46: //movement speed increased if(i<15) Status->Dash_up = 0xff; else Status->Dash_down = 0xff; Stats->Move_Speed = GetMoveSpeed( ); break; case 16: // haste attack case 17: // slow attack case 47: // attack speed up if(i<15) Status->Haste_up = 0xff; else Status->Haste_down = 0xff; Stats->Attack_Speed = GetAttackSpeed( ); break; case 26: // crit up case 27: // crit down case 52: // crit up if(i<15) Status->Critical_up = 0xff; else Status->Critical_down = 0xff; Stats->Critical = GetCritical( ); break; case 12: // max HP up case 44: // max HP up if(i<15) Status->HP_up = 0xff; else Status->HP_down = 0xff; Stats->MaxHP = GetMaxHP( ); break; case 13: // max MP up case 45: // max MP up if(i<15) Status->MP_up = 0xff; else Status->MP_down = 0xff; Stats->MaxMP = GetMaxMP( ); break; case 32: // faint Status->Stuned = 0xff; Status->CanAttack = true; //printf("removing stun\n"); break; case 7: case 8: case 9: case 10: case 11: //poisoned Status->Poisoned = 0xff; //printf("removing poison\n"); break; case 30: // muted Status->Muted = 0xff; Status->CanCastSkill = true; break; case 31: // sleep May need to be fixed later to accomodate multiple status effects. Status->Sleep = 0xff; Status->CanMove = true; Status->CanCastSkill = true; Status->CanAttack = true; break; case 54: //A_GMExtra_Damage: case 36: //A_Extra_Damage: if(i<15) { Status->ExtraDamage_up = 0xff; Stats->ExtraDamage = 0xff; } else { Status->ExtraDamage_down = 0xff; Stats->ExtraDamage = 0xff; } break; case 56: // Taunt Status->Taunt = 0xff; break; } MagicStatus[i].Status = 0; MagicStatus[i].Buff = 0; MagicStatus[i].BuffTime = 0; MagicStatus[i].Duration = 0; MagicStatus[i].Value = 0; bflag = true; } else if (MagicStatus[i].Status >= 7 && MagicStatus[i].Status <= 11 && etime > 1*CLOCKS_PER_SEC) //Do poison dmg every 1.5 seconds { Stats->HP -= MagicStatus[i].Status; //Actually take 7, 8, 9, 10 or 11 from the health. Based on the Status itself MagicStatus[i].BuffTime += 1*CLOCKS_PER_SEC; MagicStatus[i].Duration -= 1; //printf("did %i poison dmg to the player, still %i seconds and %i HP remain \n", MagicStatus[i].Status, MagicStatus[i].Duration, Stats->HP); //A bunch of messy code to send dmg packet BEGINPACKET( pak, 0x7b6 ); ADDWORD ( pak, clientid ); // client taking damage ADDWORD ( pak, 0 ); // client doing damage ADDDWORD ( pak, 0x000007f8 ); ADDBYTE ( pak, 0x00 ); if (Stats->HP < 1) { ADDWORD ( pak, MagicStatus[i].Status + 0x8000 ); } else { ADDWORD ( pak, MagicStatus[i].Status + 0x2000 ); } //ADDDWORD ( pak, MagicStatus[i].Status ); //damage amount //If poisoned entity (player or monster) is killed if( IsDead()) { //printf("char died\n"); CDrop* thisdrop = NULL; ADDDWORD ( pak, 16 ); if( !IsSummon( ) && !IsPlayer( )) { thisdrop = GetDrop( ); if( thisdrop != NULL) { CMap* map = GServer->MapList.Index[thisdrop->posMap]; map->AddDrop( thisdrop ); } } GServer->SendToVisible( &pak, this ); // removed thisdrop from the packet } //If enemy is still alive else { ADDDWORD ( pak, 4 ); GServer->SendToVisible( &pak, this ); } } } if(bflag) { BEGINPACKET( pak,0x7b7 ); ADDWORD ( pak, clientid ); ADDDWORD ( pak, GServer->BuildBuffs( this ) ); GServer->SendToVisible( &pak, this ); } }
std::string Troop::GetDefenseString(void) const { return GetString(GetDefense()); }