Update 'Adventures in Lestoria/Monster.cpp'

pull/35/head
sigonasr2 11 months ago
parent 3ba7d0519b
commit e5ae58c4a3
  1. 19
      Adventures in Lestoria/Monster.cpp

@ -569,21 +569,28 @@ void Monster::SetStrategyDrawFunction(std::function<void(AiL*,Monster&)>func){
strategyDraw=func; strategyDraw=func;
} }
void Monster::OnDeath(){ std::map<ItemInfo*,uint16_t>Monster::SpawnDrops(){
animation.ChangeState(internal_animState,GetDeathAnimationName()); std::map<ItemInfo*,uint16_t>drops;
if(isBoss){
game->ReduceBossEncounterMobCount();
}
for(MonsterDropData data:MONSTER_DATA.at(name).GetDropData()){ for(MonsterDropData data:MONSTER_DATA.at(name).GetDropData()){
if(util::random(100)<=data.dropChance){ if(util::random(100)<=data.dropChance){
//This isn't necessarily fair odds for each quantity dropped. //This isn't necessarily fair odds for each quantity dropped.
int dropQuantity=int(data.minQty+std::round(util::random(float(data.maxQty-data.minQty)))); int dropQuantity=int(data.minQty+std::round(util::random(float(data.maxQty-data.minQty))));
for(int i=0;i<dropQuantity;i++){ for(int i=0;i<dropQuantity;i++){
ItemDrop::SpawnItem(data.item,GetPos(),OnUpperLevel()); ItemDrop::SpawnItem(data.item,GetPos(),OnUpperLevel());
drops[data.item]++;
} }
} }
} }
return drops;
}
void Monster::OnDeath(){
animation.ChangeState(internal_animState,GetDeathAnimationName());
if(isBoss){
game->ReduceBossEncounterMobCount();
}
SpawnDrops();
game->GetPlayer()->AddAccumulatedXP(MONSTER_DATA.at(name).GetXP()); game->GetPlayer()->AddAccumulatedXP(MONSTER_DATA.at(name).GetXP());
} }

Loading…
Cancel
Save