检测Bug 被销毁了的物品属性会留在身上呢?重新优化代码 并且写出完整代码if ! arg return notify_fail你要丢下什么东西?n; if sscanfarg d s amount item == 2 if ! objectpobj = presentitem me return notify_fail你身上没有这样东西。n; if wiz_levelme 3 &&
if (!arg) { return notify_fail("你要丢下什么东西?\n"); }
int amount; string item; object obj, obj2;
if (sscanf(arg, "%d %s", amount, item) == 2) { obj = present(item, me); if (!obj) { return notify_fail("你身上没有这样东西。\n"); } if (wiz_level(me) < 3 && obj->query("no_drop")) { return notify_fail(obj->name() + "不能被丢弃。\n"); } if (!obj->query_amount()) { return notify_fail(obj->name() + "不能被分开丢弃。\n"); } if (amount < 1) { return notify_fail("东西的数量至少是一个。\n"); } if (amount > obj->query_amount()) { return notify_fail("你没有那么多的" + obj->name() + "。\n"); } else if (amount == obj->query_amount()) { return do_drop(me, obj); } else { obj->set_amount(obj->query_amount() - amount); obj2 = new(base_name(obj)); obj2->set_amount(amount); if (!do_drop(me, obj2)) { obj2->move(me); return 0; } return 1; } } else { obj = present(arg, me); if (!obj) { return notify_fail("你身上没有这样东西。\n"); } if (wiz_level(me) < 3 && obj->query("no_drop")) { return notify_fail(obj->name() + "不能被丢弃。\n"); } return do_drop(me, obj); }
原文地址: https://www.cveoy.top/t/topic/bzSy 著作权归作者所有。请勿转载和采集!