Update 'Adventures in Lestoria/Monster.cpp'
This commit is contained in:
parent
3ba7d0519b
commit
e5ae58c4a3
@ -569,21 +569,28 @@ void Monster::SetStrategyDrawFunction(std::function<void(AiL*,Monster&)>func){
|
||||
strategyDraw=func;
|
||||
}
|
||||
|
||||
void Monster::OnDeath(){
|
||||
animation.ChangeState(internal_animState,GetDeathAnimationName());
|
||||
if(isBoss){
|
||||
game->ReduceBossEncounterMobCount();
|
||||
}
|
||||
|
||||
std::map<ItemInfo*,uint16_t>Monster::SpawnDrops(){
|
||||
std::map<ItemInfo*,uint16_t>drops;
|
||||
for(MonsterDropData data:MONSTER_DATA.at(name).GetDropData()){
|
||||
if(util::random(100)<=data.dropChance){
|
||||
//This isn't necessarily fair odds for each quantity dropped.
|
||||
int dropQuantity=int(data.minQty+std::round(util::random(float(data.maxQty-data.minQty))));
|
||||
for(int i=0;i<dropQuantity;i++){
|
||||
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());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user