This commit is contained in:
aozhiwei 2023-03-04 18:01:52 +08:00
parent 222106daac
commit fe8ac7eeac
3 changed files with 89 additions and 0 deletions

View File

@ -10,6 +10,23 @@
void MarkTagBuff::Activate()
{
switch (meta->_int_buff_param1) {
case 1:
{
owner->SetBuffTag(meta->_int_buff_param2, meta->_int_buff_param3);
}
break;
case 2:
{
owner->IncBuffTag(meta->_int_buff_param2, meta->_int_buff_param3);
}
break;
case 3:
{
owner->UnSetBuffTag(meta->_int_buff_param2);
}
break;
}
}
void MarkTagBuff::Deactivate()

View File

@ -171,6 +171,47 @@ int Creature::AddBuff(Creature* caster,
return 0;
}
}
if (buff_meta->buff_effect() == kBET_CondTag) {
switch (buff_meta->_int_buff_param1) {
case 1:
{
if (!(GetBuffTag(buff_meta->_int_buff_param2) >
buff_meta->_int_buff_param3)) {
return 0;
}
}
break;
case 2:
{
if (!(GetBuffTag(buff_meta->_int_buff_param2) <
buff_meta->_int_buff_param3)) {
return 0;
}
}
break;
case 3:
{
if (!(GetBuffTag(buff_meta->_int_buff_param2) ==
buff_meta->_int_buff_param3)) {
return 0;
}
}
break;
case 4:
{
if (!(GetBuffTag(buff_meta->_int_buff_param2) !=
buff_meta->_int_buff_param3)) {
return 0;
}
}
break;
default:
{
return 0;
}
break;
}
}
if (buff_meta->no_immune()) {
no_check_immune = 1;
}
@ -2818,3 +2859,29 @@ void Creature::RemoveSkillObstacle(const mt::Skill* skill_meta)
ob.Get()->Destory();
}
}
void Creature::SetBuffTag(int tag, int val)
{
buff_tags_[tag] = val;
}
int Creature::GetBuffTag(int tag)
{
auto itr = buff_tags_.find(tag);
return itr != buff_tags_.end() ? itr->second : 0;
}
void Creature::IncBuffTag(int tag, int val)
{
auto itr = buff_tags_.find(tag);
if (itr != buff_tags_.end()) {
itr->second += val;
} else {
buff_tags_[tag] = val;
}
}
void Creature::UnSetBuffTag(int tag)
{
buff_tags_.erase(tag);
}

View File

@ -321,6 +321,10 @@ class Creature : public MoveableEntity
void MarkSyncActivePlayer(const char* file, int line, const char* func);
void CheckBulletHitHoldShield(IBullet* bullet, bool& eat);
void RemoveSkillObstacle(const mt::Skill* skill_meta);
void SetBuffTag(int tag, int val);
int GetBuffTag(int tag);
void IncBuffTag(int tag, int val);
void UnSetBuffTag(int tag);
protected:
virtual void OnBuffRemove(Buff& buff);
@ -388,6 +392,7 @@ private:
a8::XTimerWp auto_switch_weapon_timer_;
a8::XTimerWp reload_delay_timer_;
int follow_times_ = 0;
std::map<int, int> buff_tags_;
int disable_move_dir_times_ = 0;
int disable_attack_dir_times_ = 0;