设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 877|回复: 2
打印 上一主题 下一主题

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

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7802
在线时间
1343 小时
注册时间
2015-8-15
帖子
752
跳转到指定楼层
1
发表于 2023-11-3 15:53:58 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
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)
RUBY 代码复制
  1. def initialize(attacker,defender)
  2.  
  3.  
  4.     @attacker = attacker
  5.     @defender = defender
  6.  
  7.     draw_info
  8.     self.opacity = 0
  9.     self.active = true
  10.  
  11.   end
  12.   def origin_x
  13.     return 0
  14.   end
  15.   def origin_y
  16.     return 0
  17.   end
  18.  
  19.  
  20.   def draw_info  #定义绘图信息
  21.     self.contents.font.size = 12
  22.     self.contents.font.color = efs_text_color(1)
  23.     self.contents.draw_text(160, 350-12*2, self.width - 40, 12, "总兵力a:", 0)
  24.     self.contents.draw_text(160, 350-12*1, self.width - 40, 12, "士气:", 0)
  25.     self.contents.font.color = efs_text_color(0)
  26.     self.contents.draw_text(160, 350, self.width - 40, 12, "轻步兵:", 0)
  27.     self.contents.draw_text(160, 350+12*1, self.width - 40, 12, "重步兵:", 0)
  28.     self.contents.draw_text(160, 350+12*2, self.width - 40, 12, "轻骑兵:", 0)
  29.     self.contents.draw_text(160, 350+12*3, self.width - 40, 12, "重骑兵:", 0)
  30.     self.contents.draw_text(160, 350+12*4, self.width - 40, 12, "远程步兵:", 0)
  31.     self.contents.draw_text(160, 350+12*5, self.width - 40, 12, "远程骑兵:", 0)
  32.     self.contents.draw_text(160, 350+12*6, self.width - 40, 12, "精英士兵:", 0)
  33.     self.contents.draw_text(160, 350+12*7, self.width - 40, 12, "特殊兵种:", 0)  
  34. #------------------------------------------------------------------------------------   
  35.     self.contents.font.color = efs_text_color(1)
  36.     self.contents.draw_text(480, 350-12*2, self.width - 40, 12, "总兵力b:", 0)
  37.     self.contents.draw_text(480, 350-12*1, self.width - 40, 12, "士气:", 0)
  38.     self.contents.font.color = efs_text_color(0)
  39.     self.contents.draw_text(480, 350, self.width - 40, 12, "轻步兵:", 0)
  40.     self.contents.draw_text(480, 350+12*1, self.width - 40, 12, "重步兵:", 0)
  41.     self.contents.draw_text(480, 350+12*2, self.width - 40, 12, "轻骑兵:", 0)
  42.     self.contents.draw_text(480, 350+12*3, self.width - 40, 12, "重骑兵:", 0)
  43.     self.contents.draw_text(480, 350+12*4, self.width - 40, 12, "远程步兵:", 0)
  44.     self.contents.draw_text(480, 350+12*5, self.width - 40, 12, "远程骑兵:", 0)
  45.     self.contents.draw_text(480, 350+12*6, self.width - 40, 12, "精英士兵:", 0)
  46.     self.contents.draw_text(480, 350+12*7, self.width - 40, 12, "特殊兵种:", 0)  
  47.     #活着的=@攻击者.获取num所有类型(true)
  48.     alives = @attacker.get_num_all_type(true)
  49.     #攻击者总数s=@攻击者.获取num所有类型
  50.     totals = @attacker.get_num_all_type
  51.     #自己目录字体。color=文本颜色(0)
  52.     self.contents.font.color = text_color(0)
  53.     the_width = 250#宽度=250
  54.     #text=@攻击者。活下去。对s+“/”+@攻击者。基本成员_大小.to_s
  55.     text = @attacker.get_alive_num.to_s+"/"+@attacker.base_member_size.to_s
  56.     #大小=自身。目录文本大小(文本)。宽度
  57.     the_size = self.contents.text_size(text).width
  58.     #自己目录绘制文本(160350-12*2,宽度-大小,12,文本,1)
  59.     self.contents.draw_text(160, 350-12*2,  the_width - the_size, 12, text, 1)
  60.     #text=@攻击者。鼓舞士气。to_s
  61.     text = @attacker.get_morale.to_s
  62.     #大小=自身。目录文本大小(文本)。宽度
  63.     the_size = self.contents.text_size(text).width
  64.      #自己目录绘制文本(160350-12*2,宽度-大小,12,文本,1)
  65.     self.contents.draw_text(160, 350-12*1,  the_width - the_size, 12, text, 1)
  66.  
  67.     #文本=总计[1]==0?“无“:活着的[1].to_s+”/“+总计[1].to_s
  68.     text = totals[1] == 0 ? "无" : alives[1].to_s+"/"+totals[1].to_s
  69.     #大小=自身。目录文本大小(文本)。宽度
  70.     the_size = self.contents.text_size(text).width
  71.     self.contents.draw_text(160, 350-0,  the_width - the_size, 12, text, 1)
  72.     text = totals[2] == 0 ? "无" : alives[2].to_s+"/"+totals[2].to_s
  73.     the_size = self.contents.text_size(text).width
  74.     self.contents.draw_text(160, 350+12*1,  the_width - the_size, 12, text, 1)
  75.     text = totals[3] == 0 ? "无" : alives[3].to_s+"/"+totals[3].to_s
  76.     the_size = self.contents.text_size(text).width
  77.     self.contents.draw_text(160, 350+12*2,  the_width - the_size, 12, text, 1)
  78.     text = totals[4] == 0 ? "无" : alives[4].to_s+"/"+totals[4].to_s
  79.     the_size = self.contents.text_size(text).width
  80.     self.contents.draw_text(160, 350+12*3,  the_width - the_size, 12, text, 1)
  81.     text = totals[5] == 0 ? "无" : alives[5].to_s+"/"+totals[5].to_s
  82.     the_size = self.contents.text_size(text).width
  83.     self.contents.draw_text(160, 350+12*4,  the_width - the_size, 12, text, 1)
  84.     text = totals[6] == 0 ? "无" : alives[6].to_s+"/"+totals[6].to_s
  85.     the_size = self.contents.text_size(text).width
  86.     self.contents.draw_text(160, 350+12*5,  the_width - the_size, 12, text, 1)
  87.     text = totals[7] == 0 ? "无" : alives[7].to_s+"/"+totals[7].to_s
  88.     the_size = self.contents.text_size(text).width
  89.     self.contents.draw_text(160, 350+12*6,  the_width - the_size, 12, text, 1)
  90.     text = totals[8] == 0 ? "无" : alives[8].to_s+"/"+totals[8].to_s
  91.     the_size = self.contents.text_size(text).width
  92.     self.contents.draw_text(160, 350+12*7,  the_width - the_size, 12, text, 1)
  93.     #活着的=@攻击者.获取num所有类型(true)
  94.     alives = @defender.get_num_all_type(true)
  95.     #攻击者总数s=@攻击者.获取num所有类型
  96.     totals = @defender.get_num_all_type
  97.  
  98.  
  99.     #自己目录字体。color=文本颜色(0)
  100.     self.contents.font.color = text_color(0)
  101.     the_width = 250#宽度=250
  102.     ##text=@防御者。活下去。对s+“/”+@防守者。基本成员_大小.to_s
  103.     text = @defender.get_alive_num.to_s+"/"+@defender.base_member_size.to_s
  104.     the_size = self.contents.text_size(text).width
  105.     self.contents.draw_text(480, 350-12*2,  the_width - the_size, 12, text, 1)
  106.  
  107.     text = @defender.get_morale.to_s
  108.     the_size = self.contents.text_size(text).width
  109.     self.contents.draw_text(480, 350-12*1,  the_width - the_size, 12, text, 1)
  110.  
  111.     text = totals[1] == 0 ? "无" : alives[1].to_s+"/"+totals[1].to_s
  112.     the_size = self.contents.text_size(text).width
  113.     self.contents.draw_text(480, 350-0,  the_width - the_size, 12, text, 1)
  114.     text = totals[2] == 0 ? "无" : alives[2].to_s+"/"+totals[2].to_s
  115.     the_size = self.contents.text_size(text).width
  116.     self.contents.draw_text(480, 350+12*1,  the_width - the_size, 12, text, 1)
  117.     text = totals[3] == 0 ? "无" : alives[3].to_s+"/"+totals[3].to_s
  118.     the_size = self.contents.text_size(text).width
  119.     self.contents.draw_text(480, 350+12*2,  the_width - the_size, 12, text, 1)
  120.     text = totals[4] == 0 ? "无" : alives[4].to_s+"/"+totals[4].to_s
  121.     the_size = self.contents.text_size(text).width
  122.     self.contents.draw_text(480, 350+12*3,  the_width - the_size, 12, text, 1)
  123.     text = totals[5] == 0 ? "无" : alives[5].to_s+"/"+totals[5].to_s
  124.     the_size = self.contents.text_size(text).width
  125.     self.contents.draw_text(480, 350+12*4,  the_width - the_size, 12, text, 1)
  126.     text = totals[6] == 0 ? "无" : alives[6].to_s+"/"+totals[6].to_s
  127.     the_size = self.contents.text_size(text).width
  128.     self.contents.draw_text(480, 350+12*5,  the_width - the_size, 12, text, 1)
  129.     text = totals[7] == 0 ? "无" : alives[7].to_s+"/"+totals[7].to_s
  130.     the_size = self.contents.text_size(text).width
  131.     self.contents.draw_text(480, 350+12*6,  the_width - the_size, 12, text, 1)
  132.     text = totals[8] == 0 ? "无" : alives[8].to_s+"/"+totals[8].to_s
  133.     the_size = self.contents.text_size(text).width
  134.     self.contents.draw_text(480, 350+12*7,  the_width - the_size, 12, text, 1)
  135.  
  136.     #===============================================================
  137.     #self.contents.draw_text(119, 118, self.width - 40, 12, "当前效果对部队属性的影响总合(%)", 0)
  138.     self.contents.font.size = 10
  139.     self.contents.font.color = efs_text_color(0)
  140.     i = 0
  141.     dis = 49
  142.     x = 10
  143.     y = 350 + 12
  144.     self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "甲胄", 0)
  145.     i+=1
  146.     self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "生存", 0)
  147.     i+=1
  148.     self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "暴击", 0)
  149.     i = 0
  150.     self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "杀伤", 0)
  151.     i+=1  
  152.     self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "远程", 0)
  153.     i+=1
  154.     self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "反骑", 0)
  155.     i = 0
  156.     self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射速", 0)
  157.     i+=1
  158.     self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射程", 0)   
  159.     i = 0
  160.     self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "盾甲", 0)
  161.     i+=1
  162.     self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "速度", 0)
  163.     i+=1
  164.     self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "士气", 0)
  165.     i = 0
  166.     self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "破甲", 0)
  167.     i+=1  
  168.     self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "穿甲", 0)
  169.     i+=1
  170.     self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "反步", 0)
  171.     i = 0
  172.     self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "精确", 0)
  173.     i+=1
  174.     self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "弹药", 0)
  175.     i = 0
  176.     dis = 49
  177.     x = 10 + 320
  178.     y = 350 + 12
  179.     self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "甲胄", 0)
  180.     i+=1
  181.     self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "生存", 0)
  182.     i+=1
  183.     self.contents.draw_text(x + dis * i, y, self.width - 0, 10, "暴击", 0)
  184.     i = 0
  185.     self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "杀伤", 0)
  186.     i+=1  
  187.     self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "远程", 0)
  188.     i+=1
  189.     self.contents.draw_text(x + dis * i, y+15*2, self.width - 0, 10, "反骑", 0)
  190.     i = 0
  191.     self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射速", 0)
  192.     i+=1
  193.     self.contents.draw_text(x + dis * i, y+15*4, self.width - 0, 10, "射程", 0)   
  194.     i = 0
  195.     self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "盾甲", 0)
  196.     i+=1
  197.     self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "速度", 0)
  198.     i+=1
  199.     self.contents.draw_text(x + dis * i, y+15*1, self.width - 0, 10, "士气", 0)
  200.     i = 0
  201.     self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "破甲", 0)
  202.     i+=1  
  203.     self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "穿甲", 0)
  204.     i+=1
  205.     self.contents.draw_text(x + dis * i, y+15*3, self.width - 0, 10, "反步", 0)
  206.     i = 0
  207.     self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "精确", 0)
  208.     i+=1
  209.     self.contents.draw_text(x + dis * i, y+15*5, self.width - 0, 10, "弹药", 0)
  210.  
  211.     #常量状态=@攻击者。获取常量状态
  212.     const_states = @attacker.get_const_states
  213.    # 结果=常量状态数据。获取要显示的数据(常量状态)
  214.     result = Const_State_data.get_data_for_display(const_states)
  215.  
  216.     red = text_color(2)
  217.     green = text_color(3)
  218.     white = text_color(0)
  219.     self.contents.font.size = 10
  220.     x = 10 + 25
  221.     y = 350 + 12
  222.     dis = 49
  223.     for i in 0...3
  224.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  225.     self.contents.draw_text(x + dis * i, y + 15*0, self.width, 10, result[i].to_s, 0)
  226.     end
  227.     for i in 3...6
  228.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  229.     self.contents.draw_text(x + dis * (i-3), y + 15*2, self.width, 10, result[i].to_s, 0)
  230.     end
  231.     for i in 6...8
  232.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  233.     self.contents.draw_text(x + dis * (i-6), y + 15*4, self.width, 10, result[i].to_s, 0)
  234.     end
  235.     for i in 8...11
  236.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  237.     self.contents.draw_text(x + dis * (i-8), y + 15*1, self.width, 10, result[i].to_s, 0)
  238.     end
  239.     for i in 11...14
  240.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  241.     self.contents.draw_text(x + dis * (i-11), y + 15*3, self.width, 10, result[i].to_s, 0)
  242.     end
  243.     for i in 14...16
  244.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  245.     self.contents.draw_text(x + dis * (i-14), y + 15*5, self.width, 10, result[i].to_s, 0)
  246.     end
  247.     ##常量状态=@防守者。获取常量状态
  248.     const_states = @defender.get_const_states
  249.     # 结果=常量状态数据。获取要显示的数据(常量状态)
  250.     result = Const_State_data.get_data_for_display(const_states)
  251.  
  252.     x = 10 + 25 + 320
  253.     y = 350 + 12
  254.     dis = 49
  255.     for i in 0...3
  256.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  257.     self.contents.draw_text(x + dis * i, y + 15*0, self.width, 10, result[i].to_s, 0)
  258.     end
  259.     for i in 3...6
  260.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  261.     self.contents.draw_text(x + dis * (i-3), y + 15*2, self.width, 10, result[i].to_s, 0)
  262.     end
  263.     for i in 6...8
  264.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  265.     self.contents.draw_text(x + dis * (i-6), y + 15*4, self.width, 10, result[i].to_s, 0)
  266.     end
  267.     for i in 8...11
  268.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  269.     self.contents.draw_text(x + dis * (i-8), y + 15*1, self.width, 10, result[i].to_s, 0)
  270.     end
  271.     for i in 11...14
  272.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  273.     self.contents.draw_text(x + dis * (i-11), y + 15*3, self.width, 10, result[i].to_s, 0)
  274.     end
  275.     for i in 14...16
  276.     self.contents.font.color = result[i] == 100 ? white : result[i] < 100 ? red : green
  277.     self.contents.draw_text(x + dis * (i-14), y + 15*5, self.width, 10, result[i].to_s, 0)
  278.     end
  279.  
  280.     #==============================================================
  281.     #绘制走秀演员图形(@攻击者。事件角色,10,308,50)
  282.     draw_walk_actor_graphic(@attacker.event.character_name, 10,308,50)
  283.     draw_walk_actor_graphic(@defender.event.character_name,603,308,50)
  284.     self.contents.font.size = 12
  285.     self.contents.font.color = efs_text_color(1)
  286.  
  287.     self.contents.draw_text(10, 335-12, self.width, 12, @attacker.the_name, 0)
  288.     self.contents.draw_text(330, 335-12, self.width, 12, @defender.the_name, 0)
  289.      #@攻击者。发挥战斗力。到s
  290.     text = @attacker.get_battle_effective.to_s
  291.     self.contents.draw_text(10, 335, self.width, 12, "战斗力: "+text, 0)
  292.     text = @defender.get_battle_effective.to_s
  293.     self.contents.draw_text(330, 335, self.width, 12, "战斗力: "+text, 0)
  294.     self.contents.font.size = 10
  295.     self.contents.font.color = efs_text_color(0)
  296.     self.contents.draw_text(10, y - 15, self.width, 10, "当前状态对影响百分比:", 0)
  297.     self.contents.draw_text(330, y - 15, self.width, 10, "当前状态对影响百分比:", 0)
  298.  
  299.  
  300.   end
  301.  
  302.   #--------------------------------------------------------------------------
  303.   # ● 一些方法的重载
  304.   #--------------------------------------------------------------------------  
  305.   def dispose
  306.     @base.dispose
  307.     super
  308.   end
  309.   def y=(y)
  310.     super(y)
  311.     @base.y=y
  312.   end  
  313.   def visible=(visible)
  314.     super(visible)
  315.     @base.visible = visible
  316.   end
  317.   def contents_opacity=(opacity)
  318.     super(opacity)
  319.     @base.opacity = opacity   
  320.   end
  321. end

克隆1.png (9.71 KB, 下载次数: 15)

克隆1.png

Lv4.逐梦者

梦石
0
星屑
6160
在线时间
793 小时
注册时间
2019-1-20
帖子
204
2
发表于 2023-11-3 23:02:46 | 只看该作者
脚本不全,大神们也不是神仙呀OTL

点评

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

提高解答机会的方法:
看一下对应版本的帮助文件 看天气预报说今天不下雨
改变问题为更有可能的或常见的 如:天气自动变化下雨→天气系统 果然不准呀~
使用论坛的搜索功能查找相关问题 好丧啊... ...想看女装
清楚说明实际上你想解决的问题  想看坛友的女装  
脚本自己有改过的地方要标明  不要遮脸的
脚本有问题但不是默认的要全部贴出来 大胆点,尽情发
三包原则:包有BUG,包甩锅,包咕咕
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-21 20:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表