#runtime "hsp3cl" #cmpopt varinit 1 #module C […]
#runtime "hsp3cl" #cmpopt varinit 1 #module C […]
#runtime "hsp3cl" #cmpopt varinit 1 #module CharaBase _name,_hp,_mp,_waza #modcfunc name return _name #modcfunc hp return _hp #modcfunc mp return _mp #modcfunc isDead return _hp<=0 #modfunc addHp int __hp _hp+=__hp:return #modfunc addMp int __mp _mp+=__mp:return #modfunc allView mes strf("◇%s >> HP:%4d MP:%4d",_name,_hp,_mp): return #modfunc waza int id,var _chara chara=_chara: gosub _waza.id: return stat #global #module Player _name,_hp,_mp,_waza #define ctype _(%1) %1@CharaBase #define new(%1) dimtype %1,5: newmod %1,Player #modinit _name="プレイヤー" _hp=500 _mp=500 _waza=*attack,*magic,*final,*heal return *attack if rnd(10)=0 { dmg=80 crt="CRITICAL!! " } else { dmg=40 crt="" } mes _(_name)+"の攻撃! "+crt+name(_(chara))+"は"+dmg+"のダメージを負った!" addHp _(chara),-dmg return 0 *magic dmg=100 costMp=20 if _(_mp)-costMp<0: return 1 mes _(_name)+"の攻撃魔法! "+name(_(chara))+"は"+dmg+"のダメージを負った!" addHp _(chara),-dmg addMp thismod,-costMp return 0 *final dmg=300 costMp=100 if _(_mp)-costMp<0: return 1 mes _(_name)+"の必殺攻撃! "+name(_(chara))+"は"+dmg+"のダメージを負った!" addHp _(chara),-dmg addHp thismod,-50 addMp thismod,-costMp return 0 *heal healHp=100 costMp=20 if _(_mp)-costMp<0: return 1 mes _(_name)+"の回復魔法! "+name(_(chara))+"は"+healHp+"回復した!" addHp _(chara),healHp addMp thismod,-costMp return 0 #global #module Enemy _name,_hp,_mp,_waza #define ctype _(%1) %1@CharaBase #define new(%1) dimtype %1,5: newmod %1,Enemy #modinit _name="エネミー " _hp=2000 _mp=0 _waza=*attack return *attack if rnd(10)=0 { dmg=60 crt="CRITICAL!! " } else { dmg=30 crt="" } mes _(_name)+"の攻撃! "+crt+name(_(chara))+"は"+dmg+"のダメージを負った!" addHp _(chara),-dmg return 0 #global #module Program #deffunc main dim win dim loss randomize repeat ,1 mes "【BATTLE "+cnt+" FIGHT!】\n" wait 100 new@Player pl new@Enemy en allView pl allView en mes "" repeat if cnt\2=0 { repeat r=rnd(4) if r!=3: waza pl,r,en: else: waza pl,3,pl if stat=0: break loop } else { waza en,0,pl } if isDead(pl) { mes "\n"+name(pl)+"は倒れた…" loss++ break } if isDead(en) { mes "\n"+name(en)+"を倒した!" win++ break } mes "" allView pl allView en mes "" wait 100 loop mes "\nWIN: "+win+" LOSS: "+loss+"\n\n" wait 500 loop return #global main