1
This commit is contained in:
parent
545939d67e
commit
ed676e4678
@ -1049,12 +1049,18 @@ void Creature::AddSkill(int skill_id)
|
|||||||
{
|
{
|
||||||
MetaData::Skill* skill_meta = MetaMgr::Instance()->GetSkill(skill_id);
|
MetaData::Skill* skill_meta = MetaMgr::Instance()->GetSkill(skill_id);
|
||||||
if (skill_meta && !GetSkill(skill_id)) {
|
if (skill_meta && !GetSkill(skill_id)) {
|
||||||
|
if (skill_meta->i->skill_type() == 1) {
|
||||||
Skill* skill = new Skill;
|
Skill* skill = new Skill;
|
||||||
skill->owner = this;
|
skill->owner = this;
|
||||||
skill->meta = skill_meta;
|
skill->meta = skill_meta;
|
||||||
skill->xtimer_attacher.xtimer = &room->xtimer;
|
skill->xtimer_attacher.xtimer = &room->xtimer;
|
||||||
skill->Initialzie();
|
skill->Initialzie();
|
||||||
skill_hash_[skill_id] = skill;
|
skill_hash_[skill_id] = skill;
|
||||||
|
} else if (skill_meta->i->skill_type() == 2) {
|
||||||
|
AddPassiveSkill(skill_id);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -909,7 +909,7 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string& killer_name, i
|
|||||||
}
|
}
|
||||||
room->frame_event.AddHpChg(GetWeakPtrRef());
|
room->frame_event.AddHpChg(GetWeakPtrRef());
|
||||||
}
|
}
|
||||||
GetTrigger()->HpChg(old_hp, GetHP());
|
GetTrigger()->HpChg();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Human::AddToNewObjects(Entity* entity)
|
void Human::AddToNewObjects(Entity* entity)
|
||||||
|
@ -811,6 +811,20 @@ namespace MetaData
|
|||||||
param2_int_list.push_back(a8::XValue(str).GetInt());
|
param2_int_list.push_back(a8::XValue(str).GetInt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
std::vector<std::string> strings;
|
||||||
|
a8::Split(i->buff_param3(), strings, ':');
|
||||||
|
for (auto& str : strings) {
|
||||||
|
param3_int_list.push_back(a8::XValue(str).GetInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::vector<std::string> strings;
|
||||||
|
a8::Split(i->buff_param4(), strings, ':');
|
||||||
|
for (auto& str : strings) {
|
||||||
|
param4_int_list.push_back(a8::XValue(str).GetInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
{
|
{
|
||||||
std::vector<std::string> strings;
|
std::vector<std::string> strings;
|
||||||
a8::Split(i->post_remove_action(), strings, '|');
|
a8::Split(i->post_remove_action(), strings, '|');
|
||||||
|
@ -209,6 +209,8 @@ namespace MetaData
|
|||||||
int int_param4 = 0;
|
int int_param4 = 0;
|
||||||
std::vector<int> param1_int_list;
|
std::vector<int> param1_int_list;
|
||||||
std::vector<int> param2_int_list;
|
std::vector<int> param2_int_list;
|
||||||
|
std::vector<int> param3_int_list;
|
||||||
|
std::vector<int> param4_int_list;
|
||||||
std::vector<std::tuple<int, std::vector<std::tuple<int, int>>>> batch_add_list;
|
std::vector<std::tuple<int, std::vector<std::tuple<int, int>>>> batch_add_list;
|
||||||
std::vector<std::tuple<int, std::vector<int>>> post_remove_action;
|
std::vector<std::tuple<int, std::vector<int>>> post_remove_action;
|
||||||
std::set<int> immune_buffeffect;
|
std::set<int> immune_buffeffect;
|
||||||
|
@ -29,14 +29,12 @@ void Trigger::TakeonWeapon(Weapon* old_weapon, Weapon* new_weapon)
|
|||||||
switch (buff->meta->int_param3) {
|
switch (buff->meta->int_param3) {
|
||||||
case kWeaponOptTakeon:
|
case kWeaponOptTakeon:
|
||||||
{
|
{
|
||||||
AddBuff(buff->meta->int_param1, buff->meta->int_param4);
|
AddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kWeaponOptKeep:
|
case kWeaponOptKeep:
|
||||||
{
|
{
|
||||||
if (!owner_->GetBuffById(buff->meta->int_param4)) {
|
TryAddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||||
AddBuff(buff->meta->int_param1, buff->meta->int_param4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -57,7 +55,7 @@ void Trigger::Shot(MetaData::Equip* weapon_meta)
|
|||||||
[this, cond, weapon_meta] (Buff* buff, bool& stop)
|
[this, cond, weapon_meta] (Buff* buff, bool& stop)
|
||||||
{
|
{
|
||||||
if (weapon_meta->Match((CondAddBuff_e)cond, buff->meta->int_param2)) {
|
if (weapon_meta->Match((CondAddBuff_e)cond, buff->meta->int_param2)) {
|
||||||
AddBuff(buff->meta->int_param1, buff->meta->int_param4);
|
AddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -71,7 +69,7 @@ void Trigger::Kill(Creature* target)
|
|||||||
[this] (Buff* buff, bool& stop)
|
[this] (Buff* buff, bool& stop)
|
||||||
{
|
{
|
||||||
if (buff->meta->int_param2 == kill_num_) {
|
if (buff->meta->int_param2 == kill_num_) {
|
||||||
AddBuff(buff->meta->int_param1, buff->meta->int_param4);
|
AddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -83,7 +81,7 @@ void Trigger::UseItemAction(int slot_id)
|
|||||||
[this, slot_id] (Buff* buff, bool& stop)
|
[this, slot_id] (Buff* buff, bool& stop)
|
||||||
{
|
{
|
||||||
if (buff->meta->int_param2 == slot_id) {
|
if (buff->meta->int_param2 == slot_id) {
|
||||||
AddBuff(buff->meta->int_param1, buff->meta->int_param4);
|
AddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -95,12 +93,12 @@ void Trigger::UseSkill(Skill* skill)
|
|||||||
[this, skill] (Buff* buff, bool& stop)
|
[this, skill] (Buff* buff, bool& stop)
|
||||||
{
|
{
|
||||||
if (buff->meta->int_param2 == skill->meta->i->skill_id()) {
|
if (buff->meta->int_param2 == skill->meta->i->skill_id()) {
|
||||||
AddBuff(buff->meta->int_param1, buff->meta->int_param4);
|
AddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trigger::HpChg(float old_hp, float new_hp)
|
void Trigger::HpChg()
|
||||||
{
|
{
|
||||||
TraverseCondBuffs
|
TraverseCondBuffs
|
||||||
(kCondBuffHp,
|
(kCondBuffHp,
|
||||||
@ -133,8 +131,8 @@ void Trigger::HpChg(float old_hp, float new_hp)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (match && !owner_->GetBuffById(buff->meta->int_param4)) {
|
if (match) {
|
||||||
AddBuff(buff->meta->int_param1, buff->meta->int_param4);
|
TryAddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -179,19 +177,10 @@ void Trigger::TriggeCondBuffAll(int cond)
|
|||||||
(cond,
|
(cond,
|
||||||
[this, cond] (Buff* buff, bool& stop)
|
[this, cond] (Buff* buff, bool& stop)
|
||||||
{
|
{
|
||||||
AddBuff(cond, buff->meta->int_param4);
|
AddBuffs(cond, buff->meta->param4_int_list);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trigger::AddBuff(int cond, int buff_id)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
owner_->MustBeAddBuff(owner_, buff_id);
|
|
||||||
#else
|
|
||||||
owner_->TryBeAddBuff(owner_, buff_id);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void Trigger::ActiveBuff(MetaData::Buff* buff_meta)
|
void Trigger::ActiveBuff(MetaData::Buff* buff_meta)
|
||||||
{
|
{
|
||||||
for (int cond = kCondBuffUpdateBuffId; cond <= kCondBuffUpdateBuffEffect; ++cond) {
|
for (int cond = kCondBuffUpdateBuffId; cond <= kCondBuffUpdateBuffEffect; ++cond) {
|
||||||
@ -203,14 +192,12 @@ void Trigger::ActiveBuff(MetaData::Buff* buff_meta)
|
|||||||
switch (buff->meta->int_param3) {
|
switch (buff->meta->int_param3) {
|
||||||
case kBuffOptActive:
|
case kBuffOptActive:
|
||||||
{
|
{
|
||||||
AddBuff(buff->meta->int_param1, buff->meta->int_param4);
|
AddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kBuffOptKeep:
|
case kBuffOptKeep:
|
||||||
{
|
{
|
||||||
if (!owner_->GetBuffById(buff->meta->int_param4)) {
|
TryAddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||||
AddBuff(buff->meta->int_param1, buff->meta->int_param4);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -235,7 +222,7 @@ void Trigger::DeactiveBuff(MetaData::Buff* buff_meta)
|
|||||||
case kBuffOptDeactive:
|
case kBuffOptDeactive:
|
||||||
case kBuffOptKeep:
|
case kBuffOptKeep:
|
||||||
{
|
{
|
||||||
owner_->RemoveBuffById(buff->meta->int_param4);
|
RemoveBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -247,3 +234,34 @@ void Trigger::DeactiveBuff(MetaData::Buff* buff_meta)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Trigger::TryAddBuffs(int cond, std::vector<int>& buffids)
|
||||||
|
{
|
||||||
|
for (int buffid : buffids) {
|
||||||
|
if (!owner_->GetBuffById(buffid)) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
owner_->MustBeAddBuff(owner_, buffid);
|
||||||
|
#else
|
||||||
|
owner_->TryBeAddBuff(owner_, buffid);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Trigger::AddBuffs(int cond, std::vector<int>& buffids)
|
||||||
|
{
|
||||||
|
for (int buffid : buffids) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
owner_->MustBeAddBuff(owner_, buffid);
|
||||||
|
#else
|
||||||
|
owner_->TryBeAddBuff(owner_, buffid);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Trigger::RemoveBuffs(int cond, std::vector<int>& buffids)
|
||||||
|
{
|
||||||
|
for (int buffid : buffids) {
|
||||||
|
owner_->RemoveBuffById(buffid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -22,7 +22,7 @@ public:
|
|||||||
void Kill(Creature* target);
|
void Kill(Creature* target);
|
||||||
void UseItemAction(int slot_id);
|
void UseItemAction(int slot_id);
|
||||||
void UseSkill(Skill* skill);
|
void UseSkill(Skill* skill);
|
||||||
void HpChg(float old_hp, float new_hp);
|
void HpChg();
|
||||||
void Die();
|
void Die();
|
||||||
void ActiveBuff(MetaData::Buff* buff_meta);
|
void ActiveBuff(MetaData::Buff* buff_meta);
|
||||||
void DeactiveBuff(MetaData::Buff* buff_meta);
|
void DeactiveBuff(MetaData::Buff* buff_meta);
|
||||||
@ -30,7 +30,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
void TraverseCondBuffs(int cond, std::function<void (Buff*, bool&)> func);
|
void TraverseCondBuffs(int cond, std::function<void (Buff*, bool&)> func);
|
||||||
void TriggeCondBuffAll(int cond);
|
void TriggeCondBuffAll(int cond);
|
||||||
void AddBuff(int cond, int buff_id);
|
void TryAddBuffs(int cond, std::vector<int>& buffids);
|
||||||
|
void AddBuffs(int cond, std::vector<int>& buffids);
|
||||||
|
void RemoveBuffs(int cond, std::vector<int>& buffids);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Creature* owner_ = nullptr;
|
Creature* owner_ = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user