/* Rose Online Server Emulator Copyright (C) 2006,2007 OSRose Team http://www.osrose.net This program 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 (at your option) any later version. This program 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 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. depeloped with Main erose/hrose source server + some change from the original eich source */ #include "worldmonster.h" // Get Mob Attack Power unsigned int CMonster::GetAttackPower( ) { unsigned int attack; attack = thisnpc->atkpower; if(thisnpc->weapon != 0) attack += GServer->EquipList[8].Index[thisnpc->weapon]->attackpower; if(Status->Attack_up!=0xff) attack += MagicStatus[Status->Attack_up].Value; if(Status->Attack_down!=0xff) attack -= MagicStatus[Status->Attack_down].Value; return attack; } // Get Monster Defense unsigned int CMonster::GetDefense( ) { unsigned int defense; defense = thisnpc->defense; if(thisnpc->subweapon!=0) defense += GServer->EquipList[SUBWEAPON].Index[thisnpc->subweapon]->defense; if(Status->Defense_up!=0xff) defense += MagicStatus[Status->Defense_up].Value; if(Status->Defense_down!=0xff) defense -= MagicStatus[Status->Defense_down].Value; if(defense == 0)defense = 1; //hopefully stops some division by zero errors. return defense; } // Get Monster atk speed unsigned int CMonster::GetAttackSpeed( ) { unsigned int aspeed = (unsigned int)thisnpc->atkspeed; if(aspeed == 0) aspeed = 1; // prevent a /0 when hunting dragon egg if(Status->Haste_up!=0xff) aspeed += MagicStatus[Status->Haste_up].Value; if(Status->Haste_down!=0xff) aspeed -= MagicStatus[Status->Haste_down].Value; return aspeed; } // Get Monster Movement speed unsigned int CMonster::GetMoveSpeed( ) { unsigned int mspeed = 0; if (Stats->stance == 0) //mWalking. All other stances produce running animation at client { mspeed = thisnpc->wspeed; } else { mspeed = thisnpc->rspeed; } if(Status->Dash_up!=0xff) mspeed += MagicStatus[Status->Dash_up].Value; if(Status->Dash_down!=0xff) mspeed -= MagicStatus[Status->Dash_down].Value; return mspeed; } // return dodge unsigned int CMonster::GetDodge( ) { UINT dodge = 0; dodge = thisnpc->dodge; if(dodge == 0) dodge = thisnpc->defense; // prevent a /0 for hawk skill if(Status->Dodge_up!=0xff) dodge += MagicStatus[Status->Dodge_up].Value; if(Status->Dodge_down!=0xff) dodge -= MagicStatus[Status->Dodge_down].Value; if(dodge == 0)dodge = 1; //hopefully stops some division by zero errors. return dodge; } // return accury unsigned int CMonster::GetAccury( ) { UINT hitrate = 0; hitrate = thisnpc->hitrate; if(Status->Accury_up!=0xff) hitrate += MagicStatus[Status->Accury_up].Value; if(Status->Accury_down!=0xff) hitrate -= MagicStatus[Status->Accury_down].Value; return hitrate; } // return magic defense unsigned int CMonster::GetMagicDefense( ) { UINT mdef = 0; mdef = thisnpc->magicdefense; if(Status->Magic_Defense_up!=0xff) mdef += MagicStatus[Status->Magic_Defense_up].Value; if(Status->Magic_Defense_down!=0xff) mdef -= MagicStatus[Status->Magic_Defense_down].Value; if(mdef == 0)mdef = 1; //hopefully stops some division by zero errors. return mdef; } // return magic attack unsigned int CMonster::GetMagicAttack( ) { return thisnpc->magicattack; } // return max hp unsigned int CMonster::GetMaxHP( ) { UINT MaxHP = 0; MaxHP = thisnpc->hp; if(owner == 0) MaxHP *= thisnpc->level; //if(MaxHP == 0) //MaxHP = thisnpc->shp; // Bullshit. npc->shp is the flying height of a monster such as a bee. Dumb ass!! return MaxHP; } unsigned int CMonster::GetCritical( ) { return 60; //60 = 20% of 300 our critical probability } float CMonster::GetAttackDistance( ) { return thisnpc->atkdistance; } unsigned int CMonster::GetXPRate( ) { return 0; } unsigned int CMonster::GetItemDropRate( ) { return 0; } unsigned int CMonster::GetItemDropCountRate( ) { return 0; } unsigned int CMonster::GetZulyDropRate( ) { return 0; } // set monster stats values bool CMonster::SetStats( ) { 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; }