This commit is contained in:
aozhiwei 2024-01-09 13:10:16 +08:00
parent 16eca7d05e
commit c8f6cd52ce
2 changed files with 22 additions and 0 deletions

View File

@ -225,6 +225,11 @@ void Ability::RecalcAttrAddition(int attr_id)
} else if (IsValidHumanVirtualAttr(attr_id)) {
std::get<0>(vattr_add_[attr_id - kHVAT_Begin]) = new_val;
}
owner_.Get()->GetNetData()->RecalcMaxHP();
owner_.Get()->GetNetData()->RecalcAttack();
owner_.Get()->GetNetData()->RecalcDef();
owner_.Get()->GetNetData()->RecalcBlock();
owner_.Get()->GetNetData()->RecalcCrit();
}
void Ability::RecalcAttrRuduce(int attr_id)
@ -275,6 +280,11 @@ void Ability::RecalcAttrRuduce(int attr_id)
} else if (IsValidHumanVirtualAttr(attr_id)) {
std::get<0>(vattr_dec_[attr_id - kHVAT_Begin]) = new_val;
}
owner_.Get()->GetNetData()->RecalcMaxHP();
owner_.Get()->GetNetData()->RecalcAttack();
owner_.Get()->GetNetData()->RecalcDef();
owner_.Get()->GetNetData()->RecalcBlock();
owner_.Get()->GetNetData()->RecalcCrit();
}
float Ability::GetAttrAddition(int attr_id)

View File

@ -234,6 +234,10 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
float value = a8::XValue(cmds[3]).GetDouble();
if (target) {
target->GetAbility()->AddAttr(attr_id, value);
std::vector<std::string> strings = target->GetAbility()->GMShowAttrs();
for (auto& str : strings) {
SendDebugMsg("数值: " + str);
}
}
}
} else if (cmd == "del_attr") {
@ -244,6 +248,10 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
int idx = a8::XValue(cmds[3]);
if (target) {
target->GetAbility()->GMDelAttr(attr_id, idx);
std::vector<std::string> strings = target->GetAbility()->GMShowAttrs();
for (auto& str : strings) {
SendDebugMsg("数值: " + str);
}
}
}
} else if (cmd == "clear_attr") {
@ -252,6 +260,10 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
room->GetCreatureByUniId(a8::XValue(cmds[1]).GetInt());
if (target) {
target->GetAbility()->GMClearAttr();
std::vector<std::string> strings = target->GetAbility()->GMShowAttrs();
for (auto& str : strings) {
SendDebugMsg("数值: " + str);
}
}
}
} else if (cmd == "show_attrs") {