1
This commit is contained in:
parent
ed676e4678
commit
211ab7a7e1
@ -1737,6 +1737,9 @@ void Creature::SetCurrWeapon(Weapon* weapon)
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
if (curr_weapon_ != weapon) {
|
||||
GetTrigger()->TakeonWeapon(curr_weapon_, weapon);
|
||||
}
|
||||
curr_weapon_ = weapon;
|
||||
}
|
||||
|
||||
|
@ -19,31 +19,57 @@ void Trigger::UnInit()
|
||||
|
||||
void Trigger::TakeonWeapon(Weapon* old_weapon, Weapon* new_weapon)
|
||||
{
|
||||
MetaData::Equip* new_weapon_meta = new_weapon->meta;
|
||||
for (int cond = kCondBuffUpdateWeaponId; cond <= kCondBuffUpdateWeaponType; cond++) {
|
||||
TraverseCondBuffs
|
||||
(cond,
|
||||
[this, cond, new_weapon_meta] (Buff* buff, bool& stop)
|
||||
{
|
||||
if (new_weapon_meta->Match((CondAddBuff_e)cond, buff->meta->int_param2)) {
|
||||
switch (buff->meta->int_param3) {
|
||||
case kWeaponOptTakeon:
|
||||
{
|
||||
AddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||
{
|
||||
MetaData::Equip* weapon_meta = new_weapon->meta;
|
||||
for (int cond = kCondBuffUpdateWeaponId; cond <= kCondBuffUpdateWeaponType; cond++) {
|
||||
TraverseCondBuffs
|
||||
(cond,
|
||||
[this, cond, weapon_meta] (Buff* buff, bool& stop)
|
||||
{
|
||||
if (weapon_meta->Match((CondAddBuff_e)cond, buff->meta->int_param2)) {
|
||||
switch (buff->meta->int_param3) {
|
||||
case kWeaponOptTakeoff:
|
||||
case kWeaponOptKeep:
|
||||
{
|
||||
RemoveBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case kWeaponOptKeep:
|
||||
{
|
||||
TryAddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
{
|
||||
MetaData::Equip* weapon_meta = new_weapon->meta;
|
||||
for (int cond = kCondBuffUpdateWeaponId; cond <= kCondBuffUpdateWeaponType; cond++) {
|
||||
TraverseCondBuffs
|
||||
(cond,
|
||||
[this, cond, weapon_meta] (Buff* buff, bool& stop)
|
||||
{
|
||||
if (weapon_meta->Match((CondAddBuff_e)cond, buff->meta->int_param2)) {
|
||||
switch (buff->meta->int_param3) {
|
||||
case kWeaponOptTakeon:
|
||||
{
|
||||
AddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||
}
|
||||
break;
|
||||
case kWeaponOptKeep:
|
||||
{
|
||||
TryAddBuffs(buff->meta->int_param1, buff->meta->param4_int_list);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user