Project1
标题: 定义的战斗力能在事件里用血条表现吗 [打印本页]
作者: 金芒芒 时间: 2023-8-26 08:28
标题: 定义的战斗力能在事件里用血条表现吗
本帖最后由 金芒芒 于 2023-8-26 09:10 编辑
class Game_Army_Slg
def get_battle_effective#定义获得实际战斗力
sum = 0#数字=0
@member.each do|group|#@每个do|组的成员|
next if group.get_all_dead#如果下一个组。全部阵亡
num = group.calculate_effective#数字=组。计算有效
sum+= num #总和+=数字
end
return sum.round*10
end
class Game_Army_Slg
def get_battle_effective#定义获得实际战斗力
sum = 0#数字=0
@member.each do|group|#@每个do|组的成员|
next if group.get_all_dead#如果下一个组。全部阵亡
num = group.calculate_effective#数字=组。计算有效
sum+= num #总和+=数字
end
return sum.round*10
end
class Window_Pre_Battle_View < Window_Base
@attacker = attacker
@defender = defender
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)
class Window_Pre_Battle_View < Window_Base
@attacker = attacker
@defender = defender
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)
class Scene_Map
#攻击者=$场景。军队[攻击者]克隆
attacker = $scene.armies[attacker].clone
#防御者=$场景。军队[防御者]克隆
defender = $scene.armies[defender].clone
@window_pre_battle_view = Window_Pre_Battle_View.new(attacker,defender)
class Scene_Map
#攻击者=$场景。军队[攻击者]克隆
attacker = $scene.armies[attacker].clone
#防御者=$场景。军队[防御者]克隆
defender = $scene.armies[defender].clone
@window_pre_battle_view = Window_Pre_Battle_View.new(attacker,defender)
-
总战力.png
(671.59 KB, 下载次数: 21)
作者: 金芒芒 时间: 2023-8-26 10:45
本帖最后由 金芒芒 于 2023-8-26 13:50 编辑
不知道错哪里了
- module ZENITH4
-
- #能源残余势力的表示?切换隐藏的开关的ID(开关接通时隐藏)
- A_SWITCH = 5
- #剩余战斗力规的长度
- A_WIDTH = 260 #AG_宽度 = 260
- #残余力量规的颜色
- AG_COLOR = Color.new(255, 0, 0, 255)
- #要显示的字符串
- AW_NAME = "攻击者剩余战斗力"
- #要显示的字符串颜色
- AW_COLOR = Color.new(255, 255, 255, 255)
- end
复制代码
事件脚本该这么写
@attacker_force = $scene.armies
[attacker].clone
(@attacker.get_battle_effective.to_s)
@attacker_force.bitmap = Bitmap.new(8 +
ZENITH4::AG_WIDTH, 34)
@attacker_force.x = 200 - (12 +
ZENITH4::AG_WIDTH) #200X坐标
@attacker_force.y = 62
@attacker_force.z = 50
@attacker_force = $scene.armies
[attacker].clone
(@attacker.get_battle_effective.to_s)
@attacker_force.bitmap = Bitmap.new(8 +
ZENITH4::AG_WIDTH, 34)
@attacker_force.x = 200 - (12 +
ZENITH4::AG_WIDTH) #200X坐标
@attacker_force.y = 62
@attacker_force.z = 50
#==============================================================================
# Zenith RGSS4 エネミー残勢力表示 ver1.00
# by 水夜
# [url]http://zenith.ifdef.jp/[/url]
#------------------------------------------------------------------------------
# 显示敌方剩余战斗力
#==============================================================================
#==============================================================================
# □ 常数设置
#==============================================================================
module ZENITH4
# エネミー残勢力の表示?非表示を切り替えるスイッチのID(スイッチON時に非表示)
#能源残余势力的表示?切换隐藏的开关的ID(开关接通时隐藏)
E_SWITCH = 1
# 残勢力ゲージの長さ#残余力量规的长度
EG_WIDTH = 160 #EG_宽度 = 160
# 残勢力ゲージの色#残余力量规的颜色
EG_COLOR = Color.new(255, 0, 0, 255)
# 表示する文字列#要显示的字符串
EW_NAME = "敌方剩余战斗力"
# 表示する文字列の色#要显示的字符串颜色
EW_COLOR = Color.new(255, 255, 255, 255)
end
#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias zenith4_initialize initialize
def initialize
# エネミー勢力スプライト作成
@enemy_force = Sprite.new
@enemy_force.bitmap = Bitmap.new(8 + ZENITH4::EG_WIDTH, 34)
@enemy_force.x = 200 - (12 + ZENITH4::EG_WIDTH) #200X坐标
@enemy_force.y = 62
@enemy_force.z = 50
# 呼び戻す
zenith4_initialize
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias zenith4_dispose dispose
def dispose
# エネミー勢力スプライト解放
@enemy_force.bitmap.dispose
@enemy_force.dispose
# 呼び戻す
zenith4_dispose
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
alias zenith4_refresh refresh
def refresh
# 呼び戻す
zenith4_refresh
if $game_switches[ZENITH4::E_SWITCH] == false
@enemy_force.visible = true
@enemy_force.bitmap.clear
x = 4
y = 4
width = ZENITH4::EG_WIDTH
# 文字列を描画
@enemy_force.bitmap.font.size = 18
@enemy_force.bitmap.font.color = Color.new(0, 0, 0, 255)
@enemy_force.bitmap.draw_text(x+1, y+1, width, 22, ZENITH4::EW_NAME)
@enemy_force.bitmap.draw_text(x-1, y-1, width, 22, ZENITH4::EW_NAME)
@enemy_force.bitmap.draw_text(x+1, y-1, width, 22, ZENITH4::EW_NAME)
@enemy_force.bitmap.draw_text(x-1, y+1, width, 22, ZENITH4::EW_NAME)
@enemy_force.bitmap.font.color = ZENITH4::EW_COLOR
@enemy_force.bitmap.draw_text(x, y, width, 22, ZENITH4::EW_NAME)
# エネミー勢力を描画
@item_max = $game_troop.enemies.size
enemy_mh = 0
enemy_h = 0
for i in 0...@item_max
enemy = $game_troop.enemies[i]
enemy_mh += enemy.maxhp
enemy_h += enemy.hp
end
@enemy_force.bitmap.fill_rect(x-1, y+24, width+2,5, Color.new(0, 0, 0, 150))
w = width * enemy_h / enemy_mh
@enemy_force.bitmap.fill_rect(x+width-w, y+25, w,3, ZENITH4::EG_COLOR)
else #右开减x-width+w
@enemy_force.visible = false
end
end
end
#==============================================================================
# Zenith RGSS4 エネミー残勢力表示 ver1.00
# by 水夜
# [url]http://zenith.ifdef.jp/[/url]
#------------------------------------------------------------------------------
# 显示敌方剩余战斗力
#==============================================================================
#==============================================================================
# □ 常数设置
#==============================================================================
module ZENITH4
# エネミー残勢力の表示?非表示を切り替えるスイッチのID(スイッチON時に非表示)
#能源残余势力的表示?切换隐藏的开关的ID(开关接通时隐藏)
E_SWITCH = 1
# 残勢力ゲージの長さ#残余力量规的长度
EG_WIDTH = 160 #EG_宽度 = 160
# 残勢力ゲージの色#残余力量规的颜色
EG_COLOR = Color.new(255, 0, 0, 255)
# 表示する文字列#要显示的字符串
EW_NAME = "敌方剩余战斗力"
# 表示する文字列の色#要显示的字符串颜色
EW_COLOR = Color.new(255, 255, 255, 255)
end
#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias zenith4_initialize initialize
def initialize
# エネミー勢力スプライト作成
@enemy_force = Sprite.new
@enemy_force.bitmap = Bitmap.new(8 + ZENITH4::EG_WIDTH, 34)
@enemy_force.x = 200 - (12 + ZENITH4::EG_WIDTH) #200X坐标
@enemy_force.y = 62
@enemy_force.z = 50
# 呼び戻す
zenith4_initialize
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias zenith4_dispose dispose
def dispose
# エネミー勢力スプライト解放
@enemy_force.bitmap.dispose
@enemy_force.dispose
# 呼び戻す
zenith4_dispose
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
alias zenith4_refresh refresh
def refresh
# 呼び戻す
zenith4_refresh
if $game_switches[ZENITH4::E_SWITCH] == false
@enemy_force.visible = true
@enemy_force.bitmap.clear
x = 4
y = 4
width = ZENITH4::EG_WIDTH
# 文字列を描画
@enemy_force.bitmap.font.size = 18
@enemy_force.bitmap.font.color = Color.new(0, 0, 0, 255)
@enemy_force.bitmap.draw_text(x+1, y+1, width, 22, ZENITH4::EW_NAME)
@enemy_force.bitmap.draw_text(x-1, y-1, width, 22, ZENITH4::EW_NAME)
@enemy_force.bitmap.draw_text(x+1, y-1, width, 22, ZENITH4::EW_NAME)
@enemy_force.bitmap.draw_text(x-1, y+1, width, 22, ZENITH4::EW_NAME)
@enemy_force.bitmap.font.color = ZENITH4::EW_COLOR
@enemy_force.bitmap.draw_text(x, y, width, 22, ZENITH4::EW_NAME)
# エネミー勢力を描画
@item_max = $game_troop.enemies.size
enemy_mh = 0
enemy_h = 0
for i in 0...@item_max
enemy = $game_troop.enemies[i]
enemy_mh += enemy.maxhp
enemy_h += enemy.hp
end
@enemy_force.bitmap.fill_rect(x-1, y+24, width+2,5, Color.new(0, 0, 0, 150))
w = width * enemy_h / enemy_mh
@enemy_force.bitmap.fill_rect(x+width-w, y+25, w,3, ZENITH4::EG_COLOR)
else #右开减x-width+w
@enemy_force.visible = false
end
end
end
剩下的血=$game_actors[1].hp
所有的血=$game_actors[1].maxhp
if $l_old_hp != 剩下的血 or ($l_old_hp1 !=
所有的血)
$l_old_hp = 剩下的血
$l_old_hp1 = 所有的血
放大率=剩下的血*100/所有的血
x坐标=41
y坐标=421
$game_screen.pictures[3].show("hp.png",
0,x坐标,y坐标,放大率,100,150,0)
end
-
战斗力.png
(31.23 KB, 下载次数: 26)
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |