Re: 關於remove_func()

看板mud_sanc (Sanctuary - 聖殿)作者 (小太保)時間18年前 (2008/01/17 20:57), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《hermis (夏目)》之銘言: : 這是脫掉裝備時才會執行的函數對吧? : int remove_func() : { : write(HIC"你放下狂戰士之斧,感覺理智又回來了,力量卻衰減不少....\n"NOR); : delete("effect/stat-str",ints); : delete("effect/stat-int",-ints); 你 delete 的語法有問題。 : return 1; : } : 我本來想讓裝備脫掉後把這兩個屬性扣回來,讓他變回原來的裝備,問題是,這樣 : 變成他脫下後那個屬性還是連在sco -l上面。原本附加的效果沒有扣回來就脫掉了 : 。 : 雖然不會出現累加的情況,quit的話屬性就會恢復,但是這樣算bug吧? remove 時不能做變更防具屬性的動作。 wear 時才可以先做。 如果你要 remove 時做,就要順便做玩家屬性的扣回... ppl = this_player(); str = query("effect/stat-str"); ints = query("effect/stat-int"); ppl->add("stat/str",-str); ppl->add("mod/stat-str",-str); ppl->add("stat/int",-ints); ppl->add("mod/stat-int",-ints); delete("effect/stat-str"); // delete 的正確語法 delete("effect/stat-int"); return 1; 這樣 remove 在執行時,它就會將該武防視為「原先就沒加 str 及 int」的物品,而不會再去更動玩家的 str 及 int。 Laechan -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.134.34.90
文章代碼(AID): #17Zr2TKC (mud_sanc)
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
文章代碼(AID): #17Zr2TKC (mud_sanc)