|
|
|
@ -68,6 +68,9 @@ InputGroup Player::KEY_ITEM1; |
|
|
|
|
InputGroup Player::KEY_ITEM2; |
|
|
|
|
InputGroup Player::KEY_ITEM3; |
|
|
|
|
|
|
|
|
|
ItemAttributable PlayerStats::equipStats; |
|
|
|
|
ItemAttributable PlayerStats::baseStats; |
|
|
|
|
|
|
|
|
|
Player::Player() |
|
|
|
|
:lastReleasedMovementKey(DOWN),facingDirection(DOWN),state(State::NORMAL){ |
|
|
|
|
Initialize(); |
|
|
|
@ -76,21 +79,20 @@ Player::Player() |
|
|
|
|
Player::Player(Player*player) |
|
|
|
|
:pos(player->GetPos()),vel(player->GetVelocity()),iframe_time(player->iframe_time),lastReleasedMovementKey(DOWN), |
|
|
|
|
facingDirection(DOWN),state(State::NORMAL){ |
|
|
|
|
player->copyTo(*this); |
|
|
|
|
Initialize(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Player::Initialize(){ |
|
|
|
|
Player::GROUND_SLAM_SPIN_TIME="Warrior.Ability 2.SpinTime"_F; |
|
|
|
|
A(ItemAttribute::health)=hp; |
|
|
|
|
A(ItemAttribute::defense)=0; |
|
|
|
|
A(ItemAttribute::attack)="Warrior.BaseAtk"_I; |
|
|
|
|
A(ItemAttribute::moveSpdPct)=100; |
|
|
|
|
A(ItemAttribute::cdrPct)=0; |
|
|
|
|
A(ItemAttribute::critPct)=0; |
|
|
|
|
A(ItemAttribute::critDmgPct)=0; |
|
|
|
|
A(ItemAttribute::healthPct)=0; |
|
|
|
|
A(ItemAttribute::healthPctRecoveryPer6sec)=0; |
|
|
|
|
SetBaseStat(ItemAttribute::health,hp); |
|
|
|
|
SetBaseStat(ItemAttribute::defense,0); |
|
|
|
|
SetBaseStat(ItemAttribute::attack,"Warrior.BaseAtk"_I); |
|
|
|
|
SetBaseStat(ItemAttribute::moveSpdPct,100); |
|
|
|
|
SetBaseStat(ItemAttribute::cdrPct,0); |
|
|
|
|
SetBaseStat(ItemAttribute::critPct,0); |
|
|
|
|
SetBaseStat(ItemAttribute::critDmgPct,0); |
|
|
|
|
SetBaseStat(ItemAttribute::healthPct,0); |
|
|
|
|
SetBaseStat(ItemAttribute::healthPctRecoveryPer6sec,0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool Player::SetX(float x){ |
|
|
|
@ -174,32 +176,32 @@ float Player::GetZ(){ |
|
|
|
|
return z; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int Player::GetHealth(){ |
|
|
|
|
const int Player::GetHealth()const{ |
|
|
|
|
return hp; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int Player::GetMaxHealth(){ |
|
|
|
|
return A(ItemAttribute::health); |
|
|
|
|
const int Player::GetMaxHealth()const{ |
|
|
|
|
return GetStat(ItemAttribute::health); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int Player::GetMana(){ |
|
|
|
|
const int Player::GetMana()const{ |
|
|
|
|
return mana; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int Player::GetMaxMana() { |
|
|
|
|
const int Player::GetMaxMana()const{ |
|
|
|
|
return maxmana; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int Player::GetAttack(){ |
|
|
|
|
float mod_atk=float(A(ItemAttribute::attack)); |
|
|
|
|
const int Player::GetAttack(){ |
|
|
|
|
float mod_atk=float(GetStat(ItemAttribute::attack)); |
|
|
|
|
for(Buff&b:GetBuffs(BuffType::ATTACK_UP)){ |
|
|
|
|
mod_atk+=A(ItemAttribute::attack)*b.intensity; |
|
|
|
|
mod_atk+=GetStat(ItemAttribute::attack)*b.intensity; |
|
|
|
|
} |
|
|
|
|
return int(mod_atk); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
float Player::GetMoveSpdMult(){ |
|
|
|
|
float mod_moveSpd=A(ItemAttribute::moveSpdPct)/100.f; |
|
|
|
|
float mod_moveSpd=GetStat(ItemAttribute::moveSpdPct)/100.f; |
|
|
|
|
for(Buff&b:GetBuffs(BuffType::SLOWDOWN)){ |
|
|
|
|
mod_moveSpd-=mod_moveSpd*b.intensity; |
|
|
|
|
} |
|
|
|
@ -789,7 +791,7 @@ void Player::SetIframes(float duration){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool Player::Heal(int damage){ |
|
|
|
|
hp=std::clamp(hp+damage,0,A(ItemAttribute::health)); |
|
|
|
|
hp=std::clamp(hp+damage,0,GetStat(ItemAttribute::health)); |
|
|
|
|
if(damage>0){ |
|
|
|
|
DAMAGENUMBER_LIST.push_back(std::make_shared<DamageNumber>(GetPos(),damage,true,HEALTH_GAIN)); |
|
|
|
|
} |
|
|
|
@ -851,4 +853,31 @@ void Player::SetItem2UseFunc(Ability a){ |
|
|
|
|
}; |
|
|
|
|
void Player::SetItem3UseFunc(Ability a){ |
|
|
|
|
useItem3=a; |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const int Player::GetStat(ItemAttribute a)const{ |
|
|
|
|
return PlayerStats::GetStat(a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const int Player::GetBaseStat(ItemAttribute a)const{ |
|
|
|
|
return PlayerStats::GetBaseStat(a); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PlayerStats::RecalculateEquipStats(){ |
|
|
|
|
baseStats.copyTo(equipStats); |
|
|
|
|
}
|
|
|
|
|
const int PlayerStats::GetStat(ItemAttribute stat){ |
|
|
|
|
return equipStats.A(stat); |
|
|
|
|
} |
|
|
|
|
const int PlayerStats::GetBaseStat(ItemAttribute stat){ |
|
|
|
|
return baseStats.A(stat); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void PlayerStats::SetBaseStat(ItemAttribute stat,int val){ |
|
|
|
|
baseStats.A(stat)=val; |
|
|
|
|
RecalculateEquipStats(); |
|
|
|
|
} |
|
|
|
|
void Player::SetBaseStat(ItemAttribute a,int val){ |
|
|
|
|
PlayerStats::SetBaseStat(a,val); |
|
|
|
|
} |