|
|
|
@ -92,8 +92,8 @@ void Player::Initialize(){ |
|
|
|
|
SetBaseStat("Attack","Warrior.BaseAtk"_I); |
|
|
|
|
SetBaseStat("Move Spd %",100); |
|
|
|
|
SetBaseStat("CDR",0); |
|
|
|
|
SetBaseStat("Crit Rate",0); |
|
|
|
|
SetBaseStat("Crit Dmg",0); |
|
|
|
|
SetBaseStat("Crit Rate","Player.Crit Rate"_F); |
|
|
|
|
SetBaseStat("Crit Dmg","Player.Crit Dmg"_F); |
|
|
|
|
SetBaseStat("Health %",0); |
|
|
|
|
SetBaseStat("HP6 Recovery %",0); |
|
|
|
|
} |
|
|
|
@ -183,7 +183,7 @@ const int Player::GetHealth()const{ |
|
|
|
|
return hp; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const int Player::GetMaxHealth()const{ |
|
|
|
|
const float&Player::GetMaxHealth()const{ |
|
|
|
|
return GetStat("Health"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -249,8 +249,13 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
notificationDisplay.second=std::max(0.f,notificationDisplay.second-fElapsedTime); |
|
|
|
|
lastHitTimer=std::max(0.f,lastHitTimer-fElapsedTime); |
|
|
|
|
blockTimer=std::max(0.f,blockTimer-fElapsedTime); |
|
|
|
|
lastCombatTime=lastCombatTime+fElapsedTime;\
|
|
|
|
|
lastCombatTime=lastCombatTime+fElapsedTime; |
|
|
|
|
manaTickTimer-=fElapsedTime; |
|
|
|
|
hpRecoveryTimer=std::max(0.f,hpRecoveryTimer-fElapsedTime); |
|
|
|
|
hp6RecoveryTimer=std::max(0.f,hp6RecoveryTimer-fElapsedTime); |
|
|
|
|
hp4RecoveryTimer=std::max(0.f,hp4RecoveryTimer-fElapsedTime); |
|
|
|
|
|
|
|
|
|
PerformHPRecovery(); |
|
|
|
|
|
|
|
|
|
CheckEndZoneCollision(); |
|
|
|
|
|
|
|
|
@ -260,7 +265,7 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
bool allowed=castPrepAbility->actionPerformedDuringCast; |
|
|
|
|
if(!allowed&&castPrepAbility->action(this,castInfo.castPos))allowed=true; |
|
|
|
|
if(allowed){ |
|
|
|
|
castPrepAbility->cooldown=castPrepAbility->COOLDOWN_TIME; |
|
|
|
|
castPrepAbility->cooldown=castPrepAbility->GetCooldownTime(); |
|
|
|
|
ConsumeMana(castPrepAbility->manaCost); |
|
|
|
|
} |
|
|
|
|
castInfo.castTimer=0; |
|
|
|
@ -326,7 +331,7 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case State::SWING_SONIC_SWORD:{ |
|
|
|
|
if(ability3.COOLDOWN_TIME-ability3.cooldown>0.5){ |
|
|
|
|
if(ability3.GetCooldownTime()-ability3.cooldown>0.5){ |
|
|
|
|
SetState(State::NORMAL); |
|
|
|
|
switch(facingDirection){ |
|
|
|
|
case DOWN:{ |
|
|
|
@ -439,7 +444,7 @@ void Player::Update(float fElapsedTime){ |
|
|
|
|
if(key.Held()||key.Released()&&&ability==castPrepAbility&&GetState()==State::PREP_CAST){ |
|
|
|
|
if(AllowedToCast(ability)&&ability.action(this,{})){ |
|
|
|
|
bool allowed=ability.actionPerformedDuringCast; |
|
|
|
|
ability.cooldown=ability.COOLDOWN_TIME; |
|
|
|
|
ability.cooldown=ability.GetCooldownTime(); |
|
|
|
|
CancelCast(); |
|
|
|
|
ConsumeMana(ability.manaCost); |
|
|
|
|
}else |
|
|
|
@ -984,6 +989,7 @@ const float Player::GetDamageReductionFromBuffs()const{ |
|
|
|
|
for(const Buff&b:GetBuffs(BuffType::DAMAGE_REDUCTION)){ |
|
|
|
|
dmgReduction+=b.intensity; |
|
|
|
|
} |
|
|
|
|
dmgReduction+=GetDamageReductionPct(); |
|
|
|
|
return std::min(0.75f,dmgReduction); |
|
|
|
|
}; |
|
|
|
|
const float Player::GetDamageReductionFromArmor()const{ |
|
|
|
@ -1015,3 +1021,72 @@ const ItemAttributable&Player::GetStats()const{ |
|
|
|
|
ItemAttribute&Player::Get(std::string_view attr){ |
|
|
|
|
return ItemAttribute::Get(attr,this); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const float Player::GetCooldownReductionPct()const{ |
|
|
|
|
float modCDRPct=0; |
|
|
|
|
const std::vector<Buff>&buffs=GetStatBuffs({"CDR"}); |
|
|
|
|
for(const Buff&b:buffs){ |
|
|
|
|
modCDRPct+=b.intensity; |
|
|
|
|
} |
|
|
|
|
modCDRPct+=GetStat("CDR")/100; |
|
|
|
|
return modCDRPct; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const float Player::GetCritRatePct()const{ |
|
|
|
|
float modCritRatePct=0; |
|
|
|
|
modCritRatePct+=GetStat("Crit Rate")/100; |
|
|
|
|
return modCritRatePct; |
|
|
|
|
} |
|
|
|
|
const float Player::GetCritDmgPct()const{ |
|
|
|
|
float modCritDmgPct=0; |
|
|
|
|
modCritDmgPct+=GetStat("Crit Dmg")/100; |
|
|
|
|
return modCritDmgPct; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const float Player::GetHPRecoveryPct()const{ |
|
|
|
|
float modHPRecoveryPct=0; |
|
|
|
|
modHPRecoveryPct+=GetStat("HP Recovery %")/100; |
|
|
|
|
return modHPRecoveryPct; |
|
|
|
|
} |
|
|
|
|
const float Player::GetHP6RecoveryPct()const{ |
|
|
|
|
float modHPRecoveryPct=0; |
|
|
|
|
modHPRecoveryPct+=GetStat("HP6 Recovery %")/100; |
|
|
|
|
return modHPRecoveryPct; |
|
|
|
|
} |
|
|
|
|
const float Player::GetHP4RecoveryPct()const{ |
|
|
|
|
float modHPRecoveryPct=0; |
|
|
|
|
modHPRecoveryPct+=GetStat("HP4 Recovery %")/100; |
|
|
|
|
return modHPRecoveryPct; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Player::PerformHPRecovery(){ |
|
|
|
|
int hpRecoveryAmt=0; |
|
|
|
|
if(hpRecoveryTimer==0){ |
|
|
|
|
if(float(GetHPRecoveryPct()*GetMaxHealth())>0.1_Pct){ |
|
|
|
|
hpRecoveryAmt+=std::ceil(GetHPRecoveryPct()*GetMaxHealth()); |
|
|
|
|
} |
|
|
|
|
hpRecoveryTimer=1; |
|
|
|
|
} |
|
|
|
|
if(hp4RecoveryTimer==0){ |
|
|
|
|
if(float(GetHP4RecoveryPct()*GetMaxHealth())>0.1_Pct){ |
|
|
|
|
hpRecoveryAmt+=std::ceil(GetHP4RecoveryPct()*GetMaxHealth()); |
|
|
|
|
} |
|
|
|
|
hp4RecoveryTimer=4; |
|
|
|
|
} |
|
|
|
|
if(hp6RecoveryTimer==0){ |
|
|
|
|
if(float(GetHP6RecoveryPct()*GetMaxHealth())>0.1_Pct){ |
|
|
|
|
hpRecoveryAmt+=std::ceil(GetHP6RecoveryPct()*GetMaxHealth()); |
|
|
|
|
} |
|
|
|
|
hp6RecoveryTimer=6; |
|
|
|
|
} |
|
|
|
|
if(GetHealth()<GetMaxHealth()){ |
|
|
|
|
Heal(hpRecoveryAmt); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const float Player::GetDamageReductionPct()const{ |
|
|
|
|
float modDmgReductionPct=0; |
|
|
|
|
modDmgReductionPct+=GetStat("Damage Reduction")/100; |
|
|
|
|
return modDmgReductionPct; |
|
|
|
|
} |