Project1
标题:
求个魔塔的脚本
[打印本页]
作者:
thzy236
时间:
2012-5-8 19:52
标题:
求个魔塔的脚本
就是可以给怪物加一个属性,第一回合不攻击。 dsu_plus_rewardpost_czw
作者:
LOVE丶莫颜
时间:
2012-5-10 22:41
这个在数据库里可以完成。
作者:
春风莉露
时间:
2012-5-11 12:41
本帖最后由 春风莉露 于 2012-5-11 12:44 编辑
喔喔
请在战斗事件里设置即可。
楼主的题目跟问题不同呀
附加:
魔塔式的战斗.rar
(197.42 KB, 下载次数: 425)
2012-5-11 12:44 上传
点击文件名下载附件
作者:
hys111111
时间:
2012-5-11 13:23
看你的样板啊……这是原脚本
#==============================================================================
# ■ Enemy_property
#------------------------------------------------------------------------------
# 确定怪物的属性及伤害等。
#==============================================================================
class Enemy_property
#--------------------------------------------------------------------------
# ● 初始化状态
#--------------------------------------------------------------------------
def initialize(enemyid)
@enemyid=enemyid
cal_enemy#计算怪物各种能力
end
#--------------------------------------------------------------------------
# ● 计算怪物的各种能力等
#--------------------------------------------------------------------------
def cal_enemy
#获得怪物的两种属性
@p1=$data_enemies[@enemyid].name.split(':')[1].to_i
@p1=0 if @p1==nil
@p2=$data_enemies[@enemyid].name.split(':')[2].to_i
@p2=0 if @p1==@p2
@p2=0 if @p2==nil#从数据库怪物id中得到两个属性,没有则属性为0
if (@p2<@p1 and @p2!=0) or (@p1==0 and @p2!=0)
@p2+=@p1
@p1=@p2-@p1
@p2=@p2-@p1
end#将较小的数放在p1中,较大的放在p2
@p3=$data_enemies[@enemyid].name.split(':')[3].to_s
@p4=$data_enemies[@enemyid].name.split(':')[4].to_i
@p5=$data_enemies[@enemyid].name.split(':')[5].to_i
@p6=$data_enemies[@enemyid].name.split(':')[6].to_i
if @p5<10
@p5="00"
[email protected]
_s
else
if @p5<100
@p5="0"
[email protected]
_s
else
@
[email protected]
_s
end
end
@orbatk=$game_variables[44]#攻击魔杖
@orbdef=$game_variables[45]#防御魔杖
@orbhp=$game_variables[46]#生命魔杖
@orbatktimes=$game_variables[47]#连击魔杖
@orbmdef=$game_variables[42]#魔防魔杖
@first=0#没有先攻的情况下@first=0
@vampire=0#吸血量
@magicatk=0#魔攻
@turnatk=1#连击
@edam=0#爆击量
@epdef=0#坚固下的防御
@reatk=0#反弹伤害
@purge=0#净化效果
@blow=0#自爆伤害
@hate=0#仇恨伤害
@xixixi=0#攻击伤害
@pong=0#重击伤害
@mhp=$game_actors[$game_variables[1]+1].hp#基础勇生命
@ma=$game_actors[$game_variables[1]+1].str#基础勇攻
@md=$game_actors[$game_variables[1]+1].dex#基础勇防
@mmd=$game_actors[$game_variables[1]+1].int#基础勇魔防
if @p1==4 or @p2==4#吸血属性
@vampire=($game_actors[$game_variables[1]+1].hp*$game_variables[53]).to_i
end
if @p1==8 or @p2==8#坚固
if $data_enemies[@enemyid].pdef<@ma
@epdef=(@ma-$game_variables[54]).to_i
end#只有怪物基础防御小于勇士攻击后才使它的防御等于勇士攻击-1
end
if @p1==16 or @p2==16#先 攻
@first=$game_variables[55]
end
if @p1==7 or @p2==7#攻 坚
@xixixi=(@md+$game_variables[126]).to_i
end
if @p1==9993 or @p2==9993#重 击
@pong=(@md*2).to_i
end
if @p1==64 or @p2==64#魔 攻
@magicatk=@md*$game_variables[57]
@magicatk*=2 if $game_switches[59]
end
if @p1==128 or @p2==128#连击
@turnatk=$data_enemies[@enemyid].eva#从怪物的回避修正中获得连击数
end
if @p1==512 or @p2==512#爆 击
@edam=(@md*$game_variables[58]).to_i
end
if @p1==4096 or @p2==4096#模 仿
$data_enemies[@enemyid].atk=(@ma*$game_variables[60]).to_i
$data_enemies[@enemyid].pdef=(@md*$game_variables[60]).to_i
end
if @p1==9900 or @p2==9900#反 击
@reatk=(@ma*$game_variables[70]).to_i
end
if @p1==9920 or @p2==9920#净 化
@purge=(@mmd*$game_variables[104]).to_i
end
if @p1==9960 or @p2==9960#仇 恨
@hate=($game_variables[111]).to_i
end
@ea=$data_enemies[@enemyid].atk#怪攻
@ed=[$data_enemies[@enemyid].pdef, @epdef].max#怪防
@ehp=$data_enemies[@enemyid].maxhp+@vampire#怪物的生命+吸血得到的生命
@ma=($game_actors[$game_variables[1]+1].str*@orbatk).to_i#修正勇攻
@md=($game_actors[$game_variables[1]+1].dex*@orbdef).to_i#修正勇防
if $game_switches[Playerdate_magicdef]
@mmd=($game_actors[$game_variables[1]+1].int*@orbmdef).to_i#修正勇魔防
else
@mmd=0#未开启魔防下魔防=0
@purge=0
end
if @p1==9940 or @p2==9940#自 爆
@blow=1
end
if $game_party.item_number($game_variables[114])>0
@blow=0
end
if @p1==7 or @p2==7
$data_enemies[@enemyid].atk=(@xixixi).to_i
else
@xixixi=($data_enemies[@enemyid].atk).to_i
end
if @ma-@ed>0 #勇士的攻击>怪物的防御
if @md-@magicatk>=@ea+@reatk#如果勇士的防御大于怪物的攻击+反弹的伤害
@edamage=0
@edamage=@vampire+@edam+@purge+@pong-@mmd
#吸血、爆击、净化怪物的伤害等于吸血量+爆击量+净化量+重击-勇士魔防
else
@eatimes=(@ehp/((@ma-@ed)*@orbatktimes).to_i).to_i#怪物的攻击次数
@eatimes-=1 if @eatimes==@ehp*1.0/((@ma-@ed)*@orbatktimes).to_i
#整数的情况下怪物的攻击次数要-1
@eatimes+=@first #先攻的怪物要加先攻次数
@eatimes=0 if @eatimes<0#不能攻击的怪物攻击次数=0
@edamage=((@ea-@md+@reatk+@magicatk)*@turnatk*@eatimes).to_i+@vampire+@edam+@purge-@mmd
end
@edamage=0 if @edamage<=0#伤害小于0则等于0
@edamage+=@hate#仇恨的伤害无视主角防御和魔防
if @edamage<=@mhp-1 and @blow!=0
@edamage=@mhp-1
end#伤害小于勇士生命且具有自爆属性,则伤害为生命-1
@nowin=0
else#勇士的攻击<怪物的防御
if @ma-@ed>=0
@edamage=(@ea*@ehp).to_i
@eatimes=(@ehp).to_i
else
@edamage=999999#伤害等于次大
@nowin=1
end
end
if @p1==2048 or @p2==2048#怪物拥有无敌属性
if $game_party.item_number($game_variables[71])<1#未持有反无敌的物品
@edamage=9999999#伤害等于最大
@nowin=2
end
end
end
#--------------------------------------------------------------------------
# ● 返回怪物的伤害类型
#--------------------------------------------------------------------------
def got_nowin
return @nowin
#0代表可以对怪物造成伤害,1代表无法伤害,2代表怪物无敌
end
#--------------------------------------------------------------------------
# ● 返回怪物的伤害
#--------------------------------------------------------------------------
def got_damage
return @edamage
end
#--------------------------------------------------------------------------
# ● 返回怪物的攻击
#--------------------------------------------------------------------------
def got_ea
return @ea
end
#--------------------------------------------------------------------------
# ● 返回怪物的防御
#--------------------------------------------------------------------------
def got_ed
return @ed
end
#--------------------------------------------------------------------------
# ● 返回怪物的第一属性
#--------------------------------------------------------------------------
def got_p1
return @p1
end
#--------------------------------------------------------------------------
# ● 返回怪物的第二属性
#--------------------------------------------------------------------------
def got_p2
return @p2
end
#--------------------------------------------------------------------------
# ● 返回怪物再生后的图形(文件名,再生专用)
#--------------------------------------------------------------------------
def got_p3
return @p3
end
#--------------------------------------------------------------------------
# ● 返回怪物再生后的方向(再生专用)
#--------------------------------------------------------------------------
def got_p4
return @p4
end
#--------------------------------------------------------------------------
# ● 返回怪物再生后的怪物编号(再生专用)
#--------------------------------------------------------------------------
def got_p5
return @p5
end
#--------------------------------------------------------------------------
# ● 返回怪物再生后的怪物色相(再生专用)
#--------------------------------------------------------------------------
def got_p6
return @p6
end
end
复制代码
然后@eatimes-=1 if @eatimes==@ehp*1.0/((@ma-@ed)*@orbatktimes).to_i下面加一行,(144行)
@eatimes-=1 if @p1==属性编号 or @p2 == 属性编号
另外,魔塔样板7602那个属性脚本有些特别,需要注意,但是像这样子改就可以了
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1