1
This commit is contained in:
parent
7ae9640d32
commit
1a8990cc59
@ -368,7 +368,9 @@ void BattleDataContext::ParseResult(a8::XObject& obj)
|
||||
}
|
||||
if (obj.HasKey("weapon_dto1") && obj.At("weapon_dto1")->IsObject()) {
|
||||
weapon_dto1 = obj.At("weapon_dto1");
|
||||
const mt::Equip* meta = mt::Equip::GetById(weapon_dto1->Get("gun_id", 0));
|
||||
const mt::Item* item_meta = mt::Item::GetById(weapon_dto1->Get("gun_id", 0));
|
||||
if (item_meta) {
|
||||
const mt::Equip* meta = mt::Equip::GetById(item_meta->relationship());
|
||||
if (meta) {
|
||||
weapon1_ability_ = std::make_shared<WeaponAbility>();
|
||||
weapon1_ability_->weapon_uniid = weapon_dto1->Get("gun_uniid", 0);
|
||||
@ -376,9 +378,12 @@ void BattleDataContext::ParseResult(a8::XObject& obj)
|
||||
weapon1_ability_->weapon_dto = weapon_dto1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (obj.HasKey("weapon_dto2") && obj.At("weapon_dto2")->IsObject()) {
|
||||
weapon_dto2 = obj.At("weapon_dto2");
|
||||
const mt::Equip* meta = mt::Equip::GetById(weapon_dto2->Get("gun_id", 0));
|
||||
const mt::Item* item_meta = mt::Item::GetById(weapon_dto2->Get("gun_id", 0));
|
||||
if (item_meta) {
|
||||
const mt::Equip* meta = mt::Equip::GetById(item_meta->relationship());
|
||||
if (meta) {
|
||||
weapon2_ability_ = std::make_shared<WeaponAbility>();
|
||||
weapon2_ability_->weapon_uniid = weapon_dto2->Get("gun_uniid", 0);
|
||||
@ -387,6 +392,7 @@ void BattleDataContext::ParseResult(a8::XObject& obj)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleDataContext::GetHeroLvQuality(int& hero_lv, int& quality)
|
||||
{
|
||||
@ -522,7 +528,7 @@ float BattleDataContext::CalcDmg(Creature* target, IBullet* bullet)
|
||||
g_calc_dmg_context.is_crit = IsCrit(bullet) ? 1 : 0;
|
||||
|
||||
float total_atk = GetTotalAtk(bullet);
|
||||
float normal_dmg = total_atk * (1 - target->GetBattleContext()->GetDef() / 1000);
|
||||
float normal_dmg = total_atk * (1 - target->GetBattleContext()->GetDef() / (target->GetBattleContext()->GetDef() + 400));
|
||||
normal_dmg *= 1 + bullet->GetStrengthenWall();
|
||||
float crit = g_calc_dmg_context.is_crit ? GetCritRate(bullet) : 0;
|
||||
float dodge = IsDodge(bullet) ? GetDodgeRuduce(bullet) : 0;
|
||||
@ -535,10 +541,12 @@ float BattleDataContext::CalcDmg(Creature* target, IBullet* bullet)
|
||||
#ifdef DEBUG
|
||||
if (owner_.Get()->IsPlayer()) {
|
||||
std::string data = a8::Format
|
||||
("数值: 子弹攻击怪物 total_atk:%f normal_dmg:%f crit:%f dodge:%f finaly_dmg:%f target_def:%f",
|
||||
("数值: 子弹攻击怪物 total_atk:%f hero_atk:%f weapon_%f normal_dmg:%f crit:%f dodge:%f finaly_dmg:%f target_def:%f",
|
||||
{
|
||||
total_atk,
|
||||
normal_dmg,
|
||||
GetHeroTotalAtk(),
|
||||
GetWeaponAtk(bullet),
|
||||
crit,
|
||||
dodge,
|
||||
finaly_dmg,
|
||||
@ -551,7 +559,7 @@ float BattleDataContext::CalcDmg(Creature* target, IBullet* bullet)
|
||||
if (g_calc_dmg_context.is_crit) {
|
||||
g_calc_dmg_context.crit_dmg = finaly_dmg;
|
||||
}
|
||||
return finaly_dmg;
|
||||
return std::round(finaly_dmg);
|
||||
}
|
||||
|
||||
float BattleDataContext::CalcDmg(Obstacle* target, IBullet* bullet)
|
||||
|
Loading…
x
Reference in New Issue
Block a user