查看: 1596|回复: 2

[有事请教] 如何在事件中克隆出场景军队的战斗力

[复制链接]
梦石
0
星屑
7296
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
发表于 2023-11-3 15:53:58 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
a=$custom_battle_next_fighter_team
b=$custom_battle_next_fighter_enermy
c=$custom_battle_next_map_id
$scene.start_efs_nonslg(a,b,c)
在事件中
attacker = $scene.start_efs_nonslg
[a].clone   
text = @attacker.get_battle_effective.to_s
    self.contents.draw_text(10, 335,
self.width, 12, "战斗力: "+text, 0)
[pre lang="ruby"]  def initialize(attacker,defender)

   
    @attacker = attacker
    @defender = defender
   
    draw_info
    self.opacity = 0
    self.active = true
   
  end
  def origin_x
    return 0
  end
  def origin_y
    return 0
  end

  
  def draw_info  #定义绘图信息
    self.contents.font.size = 12
    self.contents.font.color = efs_text_color(1)
    self.contents.draw_text(160, 350-12*2, self.width - 40, 12, "总兵力a:", 0)
    self.contents.draw_text(160, 350-12*1, self.width - 40, 12, "士气:", 0)
    self.contents.font.color = efs_text_color(0)
    self.contents.draw_text(160, 350, self.width - 40, 12, "轻步兵:", 0)
    self.contents.draw_text(160, 350+12*1, self.width - 40, 12, "重步兵:", 0)
    self.contents.draw_text(160, 350+12*2, self.width - 40, 12, "轻骑兵:", 0)
    self.contents.draw_text(160, 350+12*3, self.width - 40, 12, "重骑兵:", 0)
    self.contents.draw_text(160, 350+12*4, self.width - 40, 12, "远程步兵:", 0)
    self.contents.draw_text(160, 350+12*5, self.width - 40, 12, "远程骑兵:", 0)
    self.contents.draw_text(160, 350+12*6, self.width - 40, 12, "精英士兵:", 0)
    self.contents.draw_text(160, 350+12*7, self.width - 40, 12, "特殊兵种:", 0)  
#------------------------------------------------------------------------------------   
    self.contents.font.color = efs_text_color(1)
    self.contents.draw_text(480, 350-12*2, self.width - 40, 12, "总兵力b:", 0)
    self.contents.draw_text(480, 350-12*1, self.width - 40, 12, "士气:", 0)
    self.contents.font.color = efs_text_color(0)
    self.contents.draw_text(480, 350, self.width - 40, 12, "轻步兵:", 0)
    self.contents.draw_text(480, 350+12*1, self.width - 40, 12, "重步兵:", 0)
    self.contents.draw_text(480, 350+12*2, self.width - 40, 12, "轻骑兵:", 0)
    self.contents.draw_text(480, 350+12*3, self.width - 40, 12, "重骑兵:", 0)
    self.contents.draw_text(480, 350+12*4, self.width - 40, 12, "远程步兵:", 0)
    self.contents.draw_text(480, 350+12*5, self.width - 40, 12, "远程骑兵:", 0)
    self.contents.draw_text(480, 350+12*6, self.width - 40, 12, "精英士兵:", 0)
    self.contents.draw_text(480, 350+12*7, self.width - 40, 12, "特殊兵种:", 0)  
    #活着的=@攻击者.获取num所有类型(true)
    alives = @attacker.get_num_all_type(true)
    #攻击者总数s=@攻击者.获取num所有类型
    totals = @attacker.get_num_all_type
    #自己目录字体。color=文本颜色(0)
    self.contents.font.color = text_color(0)
    the_width = 250#宽度=250
    #text=@攻击者。活下去。对s+“/”+@攻击者。基本成员_大小.to_s
    text = @attacker.get_alive_num.to_s+"/"+@attacker.base_member_size.to_s
    #大小=自身。目录文本大小(文本)。宽度
    the_size = self.contents.text_size(text).width
    #自己目录绘制文本(160350-12*2,宽度-大小,12,文本,1)
    self.contents.draw_text(160, 350-12*2,  the_width - the_size, 12, text, 1)
    #text=@攻击者。鼓舞士气。to_s
    text = @attacker.get_morale.to_s
    #大小=自身。目录文本大小(文本)。宽度
    the_size = self.contents.text_size(text).width
     #自己目录绘制文本(160350-12*2,宽度-大小,12,文本,1)
    self.contents.draw_text(160, 350-12*1,  the_width - the_size, 12, text, 1)
   
    #文本=总计[1]==0?“无“:活着的[1].to_s+”/“+总计[1].to_s
    text = totals[1] == 0 ? "无" : alives[1].to_s+"/"+totals[1].to_s
    #大小=自身。目录文本大小(文本)。宽度
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350-0,  the_width - the_size, 12, text, 1)
    text = totals[2] == 0 ? "无" : alives[2].to_s+"/"+totals[2].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*1,  the_width - the_size, 12, text, 1)
    text = totals[3] == 0 ? "无" : alives[3].to_s+"/"+totals[3].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*2,  the_width - the_size, 12, text, 1)
    text = totals[4] == 0 ? "无" : alives[4].to_s+"/"+totals[4].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*3,  the_width - the_size, 12, text, 1)
    text = totals[5] == 0 ? "无" : alives[5].to_s+"/"+totals[5].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*4,  the_width - the_size, 12, text, 1)
    text = totals[6] == 0 ? "无" : alives[6].to_s+"/"+totals[6].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*5,  the_width - the_size, 12, text, 1)
    text = totals[7] == 0 ? "无" : alives[7].to_s+"/"+totals[7].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*6,  the_width - the_size, 12, text, 1)
    text = totals[8] == 0 ? "无" : alives[8].to_s+"/"+totals[8].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(160, 350+12*7,  the_width - the_size, 12, text, 1)
    #活着的=@攻击者.获取num所有类型(true)
    alives = @defender.get_num_all_type(true)
    #攻击者总数s=@攻击者.获取num所有类型
    totals = @defender.get_num_all_type
   
   
    #自己目录字体。color=文本颜色(0)
    self.contents.font.color = text_color(0)
    the_width = 250#宽度=250
    ##text=@防御者。活下去。对s+“/”+@防守者。基本成员_大小.to_s
    text = @defender.get_alive_num.to_s+"/"+@defender.base_member_size.to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350-12*2,  the_width - the_size, 12, text, 1)
   
    text = @defender.get_morale.to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350-12*1,  the_width - the_size, 12, text, 1)
   
    text = totals[1] == 0 ? "无" : alives[1].to_s+"/"+totals[1].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350-0,  the_width - the_size, 12, text, 1)
    text = totals[2] == 0 ? "无" : alives[2].to_s+"/"+totals[2].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*1,  the_width - the_size, 12, text, 1)
    text = totals[3] == 0 ? "无" : alives[3].to_s+"/"+totals[3].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*2,  the_width - the_size, 12, text, 1)
    text = totals[4] == 0 ? "无" : alives[4].to_s+"/"+totals[4].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*3,  the_width - the_size, 12, text, 1)
    text = totals[5] == 0 ? "无" : alives[5].to_s+"/"+totals[5].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*4,  the_width - the_size, 12, text, 1)
    text = totals[6] == 0 ? "无" : alives[6].to_s+"/"+totals[6].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*5,  the_width - the_size, 12, text, 1)
    text = totals[7] == 0 ? "无" : alives[7].to_s+"/"+totals[7].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*6,  the_width - the_size, 12, text, 1)
    text = totals[8] == 0 ? "无" : alives[8].to_s+"/"+totals[8].to_s
    the_size = self.contents.text_size(text).width
    self.contents.draw_text(480, 350+12*7,  the_width - the_size, 12, text, 1)
   
    #===============================================================
    #self.contents.draw_text(119, 118, self.width - 40, 12, "当前效果对部队属性的影响总合(%)", 0)
    self.contents.font.size = 10
    self.contents.font.color = efs_text_color(0)
    i = 0
    dis = 49
    x = 10
    y = 350 + 12
    self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "甲胄", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "生存", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "暴击", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "杀伤", 0)
    i+=1  
    self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "远程", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "反骑", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射速", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射程", 0)   
    i = 0
    self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "盾甲", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "速度", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "士气", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "破甲", 0)
    i+=1  
    self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "穿甲", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "反步", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "精确", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "弹药", 0)
    i = 0
    dis = 49
    x = 10 + 320
    y = 350 + 12
    self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "甲胄", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "生存", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "暴击", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "杀伤", 0)
    i+=1  
    self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "远程", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "反骑", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射速", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射程", 0)   
    i = 0
    self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "盾甲", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "速度", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "士气", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "破甲", 0)
    i+=1  
    self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "穿甲", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "反步", 0)
    i = 0
    self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "精确", 0)
    i+=1
    self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "弹药", 0)
   
    #常量状态=@攻击者。获取常量状态
    const_states = @attacker.get_const_states
   # 结果=常量状态数据。获取要显示的数据(常量状态)
    result = Const_State_data.get_data_for_display(const_states)

    red = text_color(2)
    green = text_color(3)
    white = text_color(0)
    self.contents.font.size = 10
    x = 10 + 25
    y = 350 + 12
    dis = 49
    for i in 0...3
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * i, y + 15*0, self.width, 10, result.to_s, 0)
    end
    for i in 3...6
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-3), y + 15*2, self.width, 10, result.to_s, 0)
    end
    for i in 6...8
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-6), y + 15*4, self.width, 10, result.to_s, 0)
    end
    for i in 8...11
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-8), y + 15*1, self.width, 10, result.to_s, 0)
    end
    for i in 11...14
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-11), y + 15*3, self.width, 10, result.to_s, 0)
    end
    for i in 14...16
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-14), y + 15*5, self.width, 10, result.to_s, 0)
    end
    ##常量状态=@防守者。获取常量状态
    const_states = @defender.get_const_states
    # 结果=常量状态数据。获取要显示的数据(常量状态)
    result = Const_State_data.get_data_for_display(const_states)

    x = 10 + 25 + 320
    y = 350 + 12
    dis = 49
    for i in 0...3
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * i, y + 15*0, self.width, 10, result.to_s, 0)
    end
    for i in 3...6
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-3), y + 15*2, self.width, 10, result.to_s, 0)
    end
    for i in 6...8
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-6), y + 15*4, self.width, 10, result.to_s, 0)
    end
    for i in 8...11
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-8), y + 15*1, self.width, 10, result.to_s, 0)
    end
    for i in 11...14
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-11), y + 15*3, self.width, 10, result.to_s, 0)
    end
    for i in 14...16
    self.contents.font.color = result == 100 ? white : result < 100 ? red : green
    self.contents.draw_text(x + dis * (i-14), y + 15*5, self.width, 10, result.to_s, 0)
    end

    #==============================================================
    #绘制走秀演员图形(@攻击者。事件角色,10,308,50)
    draw_walk_actor_graphic(@attacker.event.character_name, 10,308,50)
    draw_walk_actor_graphic(@defender.event.character_name,603,308,50)
    self.contents.font.size = 12
    self.contents.font.color = efs_text_color(1)
   
    self.contents.draw_text(10, 335-12, self.width, 12, @attacker.the_name, 0)
    self.contents.draw_text(330, 335-12, self.width, 12, @defender.the_name, 0)
     #@攻击者。发挥战斗力。到s
    text = @attacker.get_battle_effective.to_s
    self.contents.draw_text(10, 335, self.width, 12, "战斗力: "+text, 0)
    text = @defender.get_battle_effective.to_s
    self.contents.draw_text(330, 335, self.width, 12, "战斗力: "+text, 0)
    self.contents.font.size = 10
    self.contents.font.color = efs_text_color(0)
    self.contents.draw_text(10, y - 15, self.width, 10, "当前状态对影响百分比:", 0)
    self.contents.draw_text(330, y - 15, self.width, 10, "当前状态对影响百分比:", 0)
   
   
  end
  
  #--------------------------------------------------------------------------
  # ● 一些方法的重载
  #--------------------------------------------------------------------------  
  def dispose
    @base.dispose
    super
  end
  def y=(y)
    super(y)
    @base.y=y
  end  
  def visible=(visible)
    super(visible)
    @base.visible = visible
  end
  def contents_opacity=(opacity)
    super(opacity)
    @base.opacity = opacity   
  end
end  [/pre]
克隆1.png
梦石
0
星屑
6295
在线时间
799 小时
注册时间
2019-1-20
回帖
223
发表于 2023-11-3 23:02:46 | 显示全部楼层
脚本不全,大神们也不是神仙呀OTL

点评

同感  发表于 2023-11-22 20:58

提高解决问题的方法:
查看对应版本的帮助文件或者默认脚本中可能相似的部分 看有没有思路能照搬(不是)
改变问题为更有可能的,常见的,系统性的 如:天气自动变化成下雨→天气系统 要多想几种可能
使用论坛的搜索功能查找相关问题 咦?这跟我想的不一样啊!讨厌啦~\(≧□≦)/~啦啦啦
清楚说明实际上你想解决的问题  想看坛友的女装,想看!  
脚本自己有改过的地方要尽量标明  提高除BUG效率 ... ...
脚本有问题但不是默认脚本的要全部贴出来 大胆点,尽情发,我说的是女装照!
三包原则:包有BUG,包甩锅,包咕咕 长期下线,急事换人!难事换人!啥事都换人!换人换人换人!!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部