MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / attack

Method attack

AgentBench.old/src/tasks/card_game/logic/src/fish.cpp:261–275  ·  view source on GitHub ↗

加布林鲨鱼和牛角鱼的被动 */

Source from the content-addressed store, hash-verified

259加布林鲨鱼和牛角鱼的被动
260*/
261std::optional<Json::Value> Fish::attack(Fish* target) {
262 //int dmg = atk / 2;
263 int dmg;
264 if((id == Fish::goblinshark) && hp * 5 < max_hp) dmg = (atk + 15) / 2;
265 else dmg = atk / 2;
266 assert(hostile != nullptr);
267 Fish* src = original ? original : this;
268
269 J json = hostile->on_damaged(src, target, dmg).value();
270 std::vector<Fish*> targets;
271 targets.clear();
272 targets.push_back(target);
273 json["skill"] = skill_to_json("normalattack", targets, hostile->player_id, dmg, 0);
274 return json;
275}
276
277std::optional<Json::Value> Fish::skill(std::vector<Fish*> my_list, std::vector<Fish*> enemy_list) {
278 return nullopt;

Callers 1

read_jsonMethod · 0.80

Calls 5

assertFunction · 0.85
skill_to_jsonFunction · 0.85
valueMethod · 0.80
on_damagedMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected