|
|
|
@ -254,7 +254,7 @@ bool Monster::Hurt(int damage,bool onUpperLevel){ |
|
|
|
|
if(!IsAlive()){ |
|
|
|
|
animation.ChangeState(internal_animState,GetDeathAnimationName()); |
|
|
|
|
} |
|
|
|
|
iframe_timer=GET_FLOAT(Attribute::IFRAME_TIME_UPON_HIT); |
|
|
|
|
iframe_timer=GetFloat(Attribute::IFRAME_TIME_UPON_HIT); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -383,4 +383,52 @@ void Monster::SetSize(float newSize,bool immediate){ |
|
|
|
|
|
|
|
|
|
void Monster::Set(_ATTRIBUTE a,std::variant<VARIANTS>val){ |
|
|
|
|
attributes[a]=val; |
|
|
|
|
//Error handling below!
|
|
|
|
|
//The idea is if we cannot retrieve the value, the program errors out.
|
|
|
|
|
switch(a.type){ |
|
|
|
|
case Attribute::TYPE::FLOAT:{ |
|
|
|
|
GetFloat(a); |
|
|
|
|
}break; |
|
|
|
|
case Attribute::TYPE::INT:{ |
|
|
|
|
GetInt(a); |
|
|
|
|
}break; |
|
|
|
|
case Attribute::TYPE::STRING:{ |
|
|
|
|
GetString(a); |
|
|
|
|
}break; |
|
|
|
|
case Attribute::TYPE::BOOL:{ |
|
|
|
|
GetBool(a); |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
float Monster::GetFloat(_ATTRIBUTE a){ |
|
|
|
|
if(attributes.count(a)>0){ |
|
|
|
|
return std::get<float>(attributes[a]); |
|
|
|
|
}else{ |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int Monster::GetInt(_ATTRIBUTE a){ |
|
|
|
|
if(attributes.count(a)>0){ |
|
|
|
|
return std::get<int>(attributes[a]); |
|
|
|
|
}else{ |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::string Monster::GetString(_ATTRIBUTE a){ |
|
|
|
|
if(attributes.count(a)>0){ |
|
|
|
|
return std::get<std::string>(attributes[a]); |
|
|
|
|
}else{ |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool Monster::GetBool(_ATTRIBUTE a){ |
|
|
|
|
if(attributes.count(a)>0){ |
|
|
|
|
return std::get<bool>(attributes[a]); |
|
|
|
|
}else{ |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
} |