设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 84|回复: 0

[转载发布] KursedVictory XP

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9015

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-7-27 12:54:23 | 显示全部楼层 |阅读模式
    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:       
    1. # * KursedVictory XP * #
    2. #   Scripter : Kyonides
    3. #   v1.2.0 - 2025-09-09
    4. # Sometimes the heroes cannot simply obtain a flawless victory. Thus, they need
    5. # some final punishment to make sure they learn their lesson!
    6. # Just add enemy ID's to the ENEMY_IDS constant to make this happen!
    7. # Warning: If you refuse to comply, you might have to fight another troop...
    8. module KursedVictory
    9.   BGS = "Darkness"
    10.   CURSOR = "sword0132"
    11.   CURSOR_OY = 4
    12.   OPTION_BACKDROP = "box240"
    13.   MESSAGE = ["Flawless Victory!", "Now choose a curse victim!"]
    14.   OPTIONS = ["Comply", "Refuse"]
    15.   OUTCOME = ["You complied with the %s's demand.",
    16.              "You refused to listen to %s."]
    17.   CURSE_CHANCE = 100
    18.   WAIT_FRAMES = 40
    19.   ENEMY_IDS = [1]
    20.   ROUND2_ENEMY_IDS = {}
    21.   ROUND2_ENEMY_IDS[1] = { :name => "Basilisk", :troop_id => 3 }
    22. end
    23. class Game_Enemy
    24.   def curse_victory?
    25.     KursedVictory::ENEMY_IDS.include?(@enemy_id)
    26.   end
    27. end
    28. class Game_Party
    29.   def dead_members
    30.     @actors.select {|actor| actor.dead? }
    31.   end
    32.   def all_dead_now?
    33.     dead_members.size == @actors.size
    34.   end
    35. end
    36. class Game_Troop
    37.   def curse_flawless_victory?
    38.     enemy = @enemies.find {|enemy| enemy.curse_victory? }
    39.     enemy != nil
    40.   end
    41. end
    42. class CursedMessageWindow < Window_Base
    43.   def initialize(wx, wy)
    44.     super(wx, wy, 280, 80)
    45.     self.contents = Bitmap.new(width - 32, height - 32)
    46.     refresh
    47.   end
    48.   def refresh
    49.     line1, line2 = KursedVictory::MESSAGE
    50.     font = self.contents.font
    51.     font.bold = true
    52.     font.color.set(220, 80, 0)
    53.     self.contents.draw_text(0, 0, width - 32, 24, line1, 1)
    54.     font.bold = false
    55.     font.color.set(255, 255, 255)
    56.     self.contents.draw_text(0, 24, width - 32, 24, line2, 1)
    57.   end
    58. end
    59. module KursedVictory
    60.   class TextBox
    61.     def initialize(pos, total, vp=nil)
    62.       @index = pos
    63.       @max = total
    64.       @row_max = 2
    65.       @col_max = 1
    66.       @viewport = vp
    67.       @backdrop = Sprite.new(vp)
    68.       @label = Sprite.new(vp)
    69.       @label.z = 50
    70.     end
    71.     def set_image(filename)
    72.       @filename = filename
    73.       set_bitmap
    74.       set_text_bitmap
    75.       reset_alignment
    76.     end
    77.     def set_bitmap
    78.       bitmap = RPG::Cache.picture(@filename)
    79.       @width = bitmap.width
    80.       @height = bitmap.height
    81.       @rect = bitmap.rect
    82.       @col_width = 640
    83.       @center_x = (@col_width - @width) / 2
    84.       @backdrop.bitmap = bitmap
    85.     end
    86.     def set_text_bitmap
    87.       @align_x = 1
    88.       @label.bitmap = Bitmap.new(@width, @height)
    89.     end
    90.     def set_align_xy
    91.       h = @height + 24
    92.       @backdrop.x = @center_x
    93.       @backdrop.y = 140 + @index * h
    94.     end
    95.     def reset_alignment
    96.       set_align_xy
    97.       @label.x = @backdrop.x
    98.       @label.y = @backdrop.y
    99.     end
    100.     def x
    101.       @backdrop.x
    102.     end
    103.     def y
    104.       @backdrop.y
    105.     end
    106.     def set_text(text)
    107.       @text = text
    108.       bit = @label.bitmap
    109.       bit.clear
    110.       bit.draw_text(@rect, text, @align_x)
    111.     end
    112.     def dispose
    113.       @label.bitmap.dispose
    114.       @label.dispose
    115.       @backdrop.bitmap.dispose
    116.       @backdrop.dispose
    117.     end
    118.     attr_reader :text
    119.   end
    120.   class Spriteset
    121.     def initialize
    122.       @curse_viewport = Viewport.new(0, 0, 640, 480)
    123.       @curse_viewport.z = 500
    124.       @curse_boxes = []
    125.       @curse_x = []
    126.       @curse_y = []
    127.       filename = KursedVictory::OPTION_BACKDROP
    128.       options = KursedVictory::OPTIONS
    129.       options.each_with_index do |choice, n|
    130.         box = KursedVictory::TextBox.new(n, options.size, @curse_viewport)
    131.         box.set_image(filename)
    132.         box.set_text(choice)
    133.         @curse_x << box.x
    134.         @curse_y << box.y + KursedVictory::CURSOR_OY
    135.         @curse_boxes << box
    136.       end
    137.       @cursed_cursor = Sprite.new(@curse_viewport)
    138.       @cursed_cursor.x = @curse_x[0]
    139.       @cursed_cursor.y = @curse_y[0]
    140.       @cursed_cursor.bitmap = RPG::Cache.icon(KursedVictory::CURSOR)
    141.     end
    142.     def move_cursor(index)
    143.       @cursed_cursor.y = @curse_y[index]
    144.     end
    145.     def dispose
    146.       @curse_boxes.each {|box| box.dispose }
    147.       @cursed_cursor.bitmap.dispose
    148.       @cursed_cursor.dispose
    149.       @curse_viewport.dispose
    150.     end
    151.   end
    152. end
    153. class Scene_Battle
    154.   alias :kyon_kurvic_scn_btl_st_ph5 :start_phase5
    155.   alias :kyon_kurvic_scn_btl_up_ph5 :update_phase5
    156.   def start_phase5
    157.     process_cursed_victory
    158.     if @cursed_victory and $game_party.all_dead_now?
    159.       process_defeat
    160.       return
    161.     end
    162.     kyon_kurvic_scn_btl_st_ph5
    163.   end
    164.   def update_phase5
    165.     if @curse_lifted and Input.trigger?(Input::C)
    166.       start_anti_curse_battle
    167.       return
    168.     end
    169.     kyon_kurvic_scn_btl_up_ph5
    170.   end
    171.   def start_anti_curse_battle
    172.     Audio.bgm_stop
    173.     Audio.bgs_stop
    174.     $game_party.clear_actions
    175.     $game_troop.enemies.clear
    176.     $game_temp.battle_troop_id = @round2_data[:troop_id]
    177.     $game_system.se_play($data_system.battle_start_se)
    178.     $game_system.bgm_play($game_system.battle_bgm)
    179.     $scene = Scene_Battle.new
    180.   end
    181.   def process_cursed_victory
    182.     return if KursedVictory::CURSE_CHANCE < rand(100)
    183.     return unless $game_troop.curse_flawless_victory?
    184.     return if $game_party.dead_members.size > 0
    185.     Audio.bgm_stop
    186.     @bgs = RPG::AudioFile.new(KursedVictory::BGS)
    187.     $game_system.bgs_play(@bgs)
    188.     wx = (Graphics.width - 280) / 2
    189.     @cursed_message = CursedMessageWindow.new(wx, 32)
    190.     @round2_data = KursedVictory::ROUND2_ENEMY_IDS[@troop_id]
    191.     if @round2_data
    192.       process_cursed_victory_options
    193.       return if @curse_lifted
    194.     end
    195.     process_cursed_victory_execution
    196.   end
    197.   def process_cursed_victory_options
    198.     @cursed_spriteset = KursedVictory::Spriteset.new
    199.     @curse_stage = 0
    200.     @curse_index = 0
    201.     @cursed_options = true
    202.     while @cursed_options
    203.       Graphics.update
    204.       Input.update
    205.       update_cursed_victory
    206.     end
    207.   end
    208.   def update_cursed_victory
    209.     case @curse_stage
    210.     when 0
    211.       update_cursed_victory_options
    212.     when 1
    213.       update_cursed_victory_decision
    214.     end
    215.   end
    216.   def update_cursed_victory_options
    217.     if Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN)
    218.       $game_system.se_play($data_system.cursor_se)
    219.       @curse_index = (@curse_index + 1) % 2
    220.       @cursed_spriteset.move_cursor(@curse_index)
    221.       return
    222.     elsif Input.trigger?(Input::C)
    223.       $game_system.se_play($data_system.decision_se)
    224.       name = @round2_data[:name]
    225.       if name
    226.         @curse_text = KursedVictory::OUTCOME[@curse_index]
    227.         @curse_text = sprintf(@curse_text, name)
    228.       end
    229.       @cursed_spriteset.dispose
    230.       if @curse_index == 1
    231.         Audio.bgs_stop
    232.         @cursed_message.dispose
    233.         @curse_lifted = true
    234.       end
    235.       if name
    236.         ow = 480
    237.         bitmap = Bitmap.new(ow - 32, 32)
    238.         bitmap.draw_text(0, 0, bitmap.width, 32, @curse_text, 1)
    239.         @outcome_window = Window_Base.new(80, 160, ow, 64)
    240.         @outcome_window.contents = bitmap
    241.         @outcome_window.pause = true
    242.         @curse_stage = 1
    243.       else
    244.         @cursed_options = @curse_stage = nil
    245.       end
    246.     end
    247.   end
    248.   def update_cursed_victory_decision
    249.     @outcome_window.update
    250.     if Input.trigger?(Input::C)
    251.       $game_system.se_play($data_system.decision_se)
    252.       @outcome_window.dispose
    253.       @cursed_options = @curse_stage = nil
    254.     end
    255.   end
    256.   def process_cursed_victory_execution
    257.     @cursed_cursor = Arrow_Actor.new(nil)
    258.     @cursed_cursor.index = 0
    259.     @cursed_victory = true
    260.     while @cursed_victory
    261.       Graphics.update
    262.       Input.update
    263.       update_cursed_victory_execution
    264.     end
    265.     KursedVictory::WAIT_FRAMES.times { Graphics.update }
    266.     @cursed_message.dispose
    267.     @cursed_cursor.bitmap.dispose
    268.     @cursed_cursor.dispose
    269.     Audio.bgs_stop
    270.     @cursed_victory = true
    271.   end
    272.   def update_cursed_victory_execution
    273.     @cursed_cursor.update
    274.     if Input.trigger?(Input::C)
    275.       $game_system.se_play($data_system.decision_se)
    276.       actor = $game_party.actors[@cursed_cursor.index]
    277.       actor.add_state(1)
    278.       @status_window.refresh
    279.       @cursed_victory = nil
    280.     end
    281.   end
    282.   def process_defeat
    283.     $game_system.bgm_play($game_temp.map_bgm)
    284.     battle_end(2)
    285.   end
    286. 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
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-4 12:49 , Processed in 0.119725 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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