1
This commit is contained in:
parent
541f6fb4ac
commit
044eaaa5a8
@ -40,6 +40,7 @@ namespace mtb
|
||||
float vOrigHaste() const { return vOrigHaste_; };
|
||||
float vOrigDrain() const { return vOrigDrain_; };
|
||||
float vOrigTenacity() const { return vOrigTenacity_; };
|
||||
float vOrigBloDef() const { return vOrigBloDef_; };
|
||||
|
||||
bool has_id() const { return __flags__.test(0);};
|
||||
bool has_pBaseHealth() const { return __flags__.test(1);};
|
||||
@ -71,6 +72,7 @@ namespace mtb
|
||||
bool has_vOrigHaste() const { return __flags__.test(27);};
|
||||
bool has_vOrigDrain() const { return __flags__.test(28);};
|
||||
bool has_vOrigTenacity() const { return __flags__.test(29);};
|
||||
bool has_vOrigBloDef() const { return __flags__.test(30);};
|
||||
|
||||
protected:
|
||||
|
||||
@ -104,9 +106,10 @@ namespace mtb
|
||||
float vOrigHaste_ = 0.0f;
|
||||
float vOrigDrain_ = 0.0f;
|
||||
float vOrigTenacity_ = 0.0f;
|
||||
float vOrigBloDef_ = 0.0f;
|
||||
|
||||
public:
|
||||
std::bitset<30> __flags__;
|
||||
std::bitset<31> __flags__;
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -901,7 +901,7 @@ namespace mtb
|
||||
{
|
||||
std::shared_ptr<a8::reflect::Class> meta_class = nullptr;
|
||||
if (!meta_class) {
|
||||
meta_class = std::make_shared<a8::reflect::Class>("BattleBasicAttribute", 30, 0);
|
||||
meta_class = std::make_shared<a8::reflect::Class>("BattleBasicAttribute", 31, 0);
|
||||
meta_class->SetSimpleField(0, "id", a8::reflect::ET_INT32, my_offsetof2(BattleBasicAttribute, id_));
|
||||
meta_class->SetSimpleField(1, "pBaseHealth", a8::reflect::ET_FLOAT, my_offsetof2(BattleBasicAttribute, pBaseHealth_));
|
||||
meta_class->SetSimpleField(2, "pOrigHealth", a8::reflect::ET_FLOAT, my_offsetof2(BattleBasicAttribute, pOrigHealth_));
|
||||
@ -932,6 +932,7 @@ namespace mtb
|
||||
meta_class->SetSimpleField(27, "vOrigHaste", a8::reflect::ET_FLOAT, my_offsetof2(BattleBasicAttribute, vOrigHaste_));
|
||||
meta_class->SetSimpleField(28, "vOrigDrain", a8::reflect::ET_FLOAT, my_offsetof2(BattleBasicAttribute, vOrigDrain_));
|
||||
meta_class->SetSimpleField(29, "vOrigTenacity", a8::reflect::ET_FLOAT, my_offsetof2(BattleBasicAttribute, vOrigTenacity_));
|
||||
meta_class->SetSimpleField(30, "vOrigBloDef", a8::reflect::ET_FLOAT, my_offsetof2(BattleBasicAttribute, vOrigBloDef_));
|
||||
}
|
||||
return meta_class;
|
||||
}
|
||||
|
@ -745,7 +745,8 @@ static float ProEffect(float p, float b)
|
||||
float x = std::floor(p) *b;
|
||||
float y = std::max(x + b, -1.0f);
|
||||
float q = (p * b - y) / (x - y);
|
||||
return 0;
|
||||
float rnd = (float)rand() / (float)RAND_MAX;
|
||||
return rnd < q ? x : y;
|
||||
} else {
|
||||
return 0.0f;
|
||||
}
|
||||
@ -755,17 +756,24 @@ float BattleDataContext::CalcDmg(Creature* target, IBullet* bullet)
|
||||
{
|
||||
g_calc_dmg_context = {0};
|
||||
g_calc_dmg_context.is_crit = 0;
|
||||
|
||||
float vEbc = 1.0f;
|
||||
float vEd = 1 - target->GetNetData()->GetDef();
|
||||
float X = (1 + hero_ability_->GetCrit()) * (1 - target->GetNetData()->GetBlock()) - 1;
|
||||
if (X > 0.00001f) {
|
||||
float vCritBon = 0.0f;
|
||||
float E = ProEffect(X, vCritBon);
|
||||
//触发暴击
|
||||
float vCritBon = hero_ability_->hero_meta->GetBasicMeta()->vOrigCriBon();
|
||||
float E = ProEffect(X, vCritBon); //E >= 0
|
||||
if (E > 0.00001f) {
|
||||
|
||||
} else {
|
||||
|
||||
vEbc = 1 + E;
|
||||
}
|
||||
} else {
|
||||
|
||||
//触发格挡 0,-1
|
||||
float vBlock = hero_ability_->hero_meta->GetBasicMeta()->vOrigBloDef();
|
||||
float E = ProEffect(X, -vBlock); //E >= 0
|
||||
if (E < 0.00001f) {
|
||||
vEbc = 1 + E;
|
||||
}
|
||||
}
|
||||
float vAttack = GetHeroTotalAtk();
|
||||
float vBullet = GetWeaponAtk(bullet);
|
||||
@ -774,8 +782,6 @@ float BattleDataContext::CalcDmg(Creature* target, IBullet* bullet)
|
||||
float vNormalDamageTakenRateIn = 0.0f;
|
||||
float vDmg = vAttack * vBullet / BDM * (1 + vNormalDamageDealtRateIn) * ( 1 + vNormalDamageTakenRateIn);
|
||||
|
||||
float vEbc = 1.0f;
|
||||
float vEd = 1 - target->GetNetData()->GetDef();
|
||||
float DDR = 0.0f;
|
||||
float DTR = 0.0f;
|
||||
float finaly_dmg = vDmg * vEbc * vEd * (1 + DDR) * (1 + DTR);
|
||||
|
@ -697,6 +697,7 @@ message BattleBasicAttribute
|
||||
optional float vOrigHaste = 28;
|
||||
optional float vOrigDrain = 29;
|
||||
optional float vOrigTenacity = 30;
|
||||
optional float vOrigBloDef = 31;
|
||||
}
|
||||
|
||||
message BattleLevelAttribute
|
||||
|
Loading…
x
Reference in New Issue
Block a user