- 累计送礼:
- 0 个
- 累计收礼:
- 1 个
TA的每日心情 | 开心 2026-7-12 04:10 |
|---|
签到天数: 209 天 连续签到: 2 天 [LV.7]常住居民III

管理员
  
- VIP
- 7
- 卡币
- 58751
- OK点
- 16
- 推广点
- 0
- 同能卷
- 50
- 积分
- 68660


|
KursedVictory XP
by Kyonides
Introduction
You will either love this scriptlet or just hate it.
Sometimes the heroes cannot simply obtain a flawless victory. That would be inconceivable!
Thus, they need some final punishment to make sure they learn their lesson!
Just add enemy ID's to the ENEMY_IDS constant to make this happen!
Warning: If you refuse to comply, you might have to fight another troop...
Spoiler: Screenshots
The Script
Ruby: - # * KursedVictory XP * #
- # Scripter : Kyonides
- # v1.2.0 - 2025-09-09
- # Sometimes the heroes cannot simply obtain a flawless victory. Thus, they need
- # some final punishment to make sure they learn their lesson!
- # Just add enemy ID's to the ENEMY_IDS constant to make this happen!
- # Warning: If you refuse to comply, you might have to fight another troop...
- module KursedVictory
- BGS = "Darkness"
- CURSOR = "sword0132"
- CURSOR_OY = 4
- OPTION_BACKDROP = "box240"
- MESSAGE = ["Flawless Victory!", "Now choose a curse victim!"]
- OPTIONS = ["Comply", "Refuse"]
- OUTCOME = ["You complied with the %s's demand.",
- "You refused to listen to %s."]
- CURSE_CHANCE = 100
- WAIT_FRAMES = 40
- ENEMY_IDS = [1]
- ROUND2_ENEMY_IDS = {}
- ROUND2_ENEMY_IDS[1] = { :name => "Basilisk", :troop_id => 3 }
- end
- class Game_Enemy
- def curse_victory?
- KursedVictory::ENEMY_IDS.include?(@enemy_id)
- end
- end
- class Game_Party
- def dead_members
- @actors.select {|actor| actor.dead? }
- end
- def all_dead_now?
- dead_members.size == @actors.size
- end
- end
- class Game_Troop
- def curse_flawless_victory?
- enemy = @enemies.find {|enemy| enemy.curse_victory? }
- enemy != nil
- end
- end
- class CursedMessageWindow < Window_Base
- def initialize(wx, wy)
- super(wx, wy, 280, 80)
- self.contents = Bitmap.new(width - 32, height - 32)
- refresh
- end
- def refresh
- line1, line2 = KursedVictory::MESSAGE
- font = self.contents.font
- font.bold = true
- font.color.set(220, 80, 0)
- self.contents.draw_text(0, 0, width - 32, 24, line1, 1)
- font.bold = false
- font.color.set(255, 255, 255)
- self.contents.draw_text(0, 24, width - 32, 24, line2, 1)
- end
- end
- module KursedVictory
- class TextBox
- def initialize(pos, total, vp=nil)
- @index = pos
- @max = total
- @row_max = 2
- @col_max = 1
- @viewport = vp
- @backdrop = Sprite.new(vp)
- @label = Sprite.new(vp)
- @label.z = 50
- end
- def set_image(filename)
- @filename = filename
- set_bitmap
- set_text_bitmap
- reset_alignment
- end
- def set_bitmap
- bitmap = RPG::Cache.picture(@filename)
- @width = bitmap.width
- @height = bitmap.height
- @rect = bitmap.rect
- @col_width = 640
- @center_x = (@col_width - @width) / 2
- @backdrop.bitmap = bitmap
- end
- def set_text_bitmap
- @align_x = 1
- @label.bitmap = Bitmap.new(@width, @height)
- end
- def set_align_xy
- h = @height + 24
- @backdrop.x = @center_x
- @backdrop.y = 140 + @index * h
- end
- def reset_alignment
- set_align_xy
- @label.x = @backdrop.x
- @label.y = @backdrop.y
- end
- def x
- @backdrop.x
- end
- def y
- @backdrop.y
- end
- def set_text(text)
- @text = text
- bit = @label.bitmap
- bit.clear
- bit.draw_text(@rect, text, @align_x)
- end
- def dispose
- @label.bitmap.dispose
- @label.dispose
- @backdrop.bitmap.dispose
- @backdrop.dispose
- end
- attr_reader :text
- end
- class Spriteset
- def initialize
- @curse_viewport = Viewport.new(0, 0, 640, 480)
- @curse_viewport.z = 500
- @curse_boxes = []
- @curse_x = []
- @curse_y = []
- filename = KursedVictory::OPTION_BACKDROP
- options = KursedVictory::OPTIONS
- options.each_with_index do |choice, n|
- box = KursedVictory::TextBox.new(n, options.size, @curse_viewport)
- box.set_image(filename)
- box.set_text(choice)
- @curse_x << box.x
- @curse_y << box.y + KursedVictory::CURSOR_OY
- @curse_boxes << box
- end
- @cursed_cursor = Sprite.new(@curse_viewport)
- @cursed_cursor.x = @curse_x[0]
- @cursed_cursor.y = @curse_y[0]
- @cursed_cursor.bitmap = RPG::Cache.icon(KursedVictory::CURSOR)
- end
- def move_cursor(index)
- @cursed_cursor.y = @curse_y[index]
- end
- def dispose
- @curse_boxes.each {|box| box.dispose }
- @cursed_cursor.bitmap.dispose
- @cursed_cursor.dispose
- @curse_viewport.dispose
- end
- end
- end
- class Scene_Battle
- alias :kyon_kurvic_scn_btl_st_ph5 :start_phase5
- alias :kyon_kurvic_scn_btl_up_ph5 :update_phase5
- def start_phase5
- process_cursed_victory
- if @cursed_victory and $game_party.all_dead_now?
- process_defeat
- return
- end
- kyon_kurvic_scn_btl_st_ph5
- end
- def update_phase5
- if @curse_lifted and Input.trigger?(Input::C)
- start_anti_curse_battle
- return
- end
- kyon_kurvic_scn_btl_up_ph5
- end
- def start_anti_curse_battle
- Audio.bgm_stop
- Audio.bgs_stop
- $game_party.clear_actions
- $game_troop.enemies.clear
- $game_temp.battle_troop_id = @round2_data[:troop_id]
- $game_system.se_play($data_system.battle_start_se)
- $game_system.bgm_play($game_system.battle_bgm)
- $scene = Scene_Battle.new
- end
- def process_cursed_victory
- return if KursedVictory::CURSE_CHANCE < rand(100)
- return unless $game_troop.curse_flawless_victory?
- return if $game_party.dead_members.size > 0
- Audio.bgm_stop
- @bgs = RPG::AudioFile.new(KursedVictory::BGS)
- $game_system.bgs_play(@bgs)
- wx = (Graphics.width - 280) / 2
- @cursed_message = CursedMessageWindow.new(wx, 32)
- @round2_data = KursedVictory::ROUND2_ENEMY_IDS[@troop_id]
- if @round2_data
- process_cursed_victory_options
- return if @curse_lifted
- end
- process_cursed_victory_execution
- end
- def process_cursed_victory_options
- @cursed_spriteset = KursedVictory::Spriteset.new
- @curse_stage = 0
- @curse_index = 0
- @cursed_options = true
- while @cursed_options
- Graphics.update
- Input.update
- update_cursed_victory
- end
- end
- def update_cursed_victory
- case @curse_stage
- when 0
- update_cursed_victory_options
- when 1
- update_cursed_victory_decision
- end
- end
- def update_cursed_victory_options
- if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
- $game_system.se_play($data_system.cursor_se)
- @curse_index = (@curse_index + 1) % 2
- @cursed_spriteset.move_cursor(@curse_index)
- return
- elsif Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- name = @round2_data[:name]
- if name
- @curse_text = KursedVictory::OUTCOME[@curse_index]
- @curse_text = sprintf(@curse_text, name)
- end
- @cursed_spriteset.dispose
- if @curse_index == 1
- Audio.bgs_stop
- @cursed_message.dispose
- @curse_lifted = true
- end
- if name
- ow = 480
- bitmap = Bitmap.new(ow - 32, 32)
- bitmap.draw_text(0, 0, bitmap.width, 32, @curse_text, 1)
- @outcome_window = Window_Base.new(80, 160, ow, 64)
- @outcome_window.contents = bitmap
- @outcome_window.pause = true
- @curse_stage = 1
- else
- @cursed_options = @curse_stage = nil
- end
- end
- end
- def update_cursed_victory_decision
- @outcome_window.update
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- @outcome_window.dispose
- @cursed_options = @curse_stage = nil
- end
- end
- def process_cursed_victory_execution
- @cursed_cursor = Arrow_Actor.new(nil)
- @cursed_cursor.index = 0
- @cursed_victory = true
- while @cursed_victory
- Graphics.update
- Input.update
- update_cursed_victory_execution
- end
- KursedVictory::WAIT_FRAMES.times { Graphics.update }
- @cursed_message.dispose
- @cursed_cursor.bitmap.dispose
- @cursed_cursor.dispose
- Audio.bgs_stop
- @cursed_victory = true
- end
- def update_cursed_victory_execution
- @cursed_cursor.update
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- actor = $game_party.actors[@cursed_cursor.index]
- actor.add_state(1)
- @status_window.refresh
- @cursed_victory = nil
- end
- end
- def process_defeat
- $game_system.bgm_play($game_temp.map_bgm)
- battle_end(2)
- end
- end
复制代码
Terms & Conditions
Free as in beer for non commercial games.
Include my nickname in your game credits.
That's it!
本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址: https://forums.rpgmakerweb.com/threads/kursedvictory-xp.179958/ |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|