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

[转载发布] KWeaponDamage XP

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

    连续签到: 2 天

    [LV.7]常住居民III

    6120

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-7-16 21:07:25 | 显示全部楼层 |阅读模式
    KWeaponDamage XP

    by Kyonides


    Introduction

    Did you ever dream about making a weapon heal your comrades instead of hitting the foe?
    Or did you ever want to hit your foes harder than usual?
    Now you can do that!


    You just need to make a few script calls to bless a specific actor with any of those new abilities.

    The Script

                    Ruby:       
    1. # * KWeaponDamage XP * #
    2. #   Scripter : Kyonides Arkanthes
    3. #   v1.1.0 - 2023-05-19
    4. # This scriptlet allows you to either consume some SP while attacking
    5. # your enemy physically or hit an ally, partially healing him or her
    6. # in the process.
    7. # It also features the vampiric weapons that drain part of your hero's HP
    8. # in order to hit the enemy (way) harder than usual.
    9. # * Script Calls * #
    10. # - First Step: Find an Actor - 2 Methods
    11. # actor = $game_actors[ActorID]
    12. # actor = $game_party.actors[Index]
    13. # - Make a Weapon Consume SP for Extra Damage
    14. # actor.weapon_sp_use(WeaponID, SP, Percent)
    15. # - Weapon No Longer Consumes SP
    16. # actor.weapon_no_sp(WeaponID)
    17. # - Clear All Weapons that Consume SP
    18. # actor.clear_weapon_sp
    19. # - Add a Weapon Blessing
    20. # actor.bless_weapon(WeaponID, Percent)
    21. # - Remove a Weapon Blessing
    22. # actor.unbless_weapon(WeaponID)
    23. # - Clear All Blessed Weapons
    24. # actor.clear_weapon_blessing
    25. # - Add a Vampiric Weapon
    26. # actor.vampire_weapon(WeaponID, HP's, Extra DMG %)
    27. # - Remove a Vampiric Weapon
    28. # actor.no_vampire_weapon(WeaponID)
    29. # - Clear All Vampiric Weapons
    30. # actor.clear_vampire_weapons
    31. class Game_Battler
    32.   DMG_MISSED = "Miss"
    33.   alias :kyon_weapon_dmg_gm_btlr_attack_fx :attack_effect
    34.   def attack_effect(attacker)
    35.     result = kyon_weapon_dmg_gm_btlr_attack_fx(attacker)
    36.     calculate_new_weapon_damage(attacker)
    37.     result
    38.   end
    39.   def calculate_new_weapon_damage(attacker)
    40.     return if @damage == DMG_MISSED
    41.     if attacker.weapon_sp_use?
    42.       total_sp = attacker.get_weapon_sp_cost
    43.       return if @sp < total_sp
    44.       attacker.sp -= total_sp
    45.       new_damage = @damage * attacker.weapon_sp_percent / 100
    46.       @damage += new_damage if @hp > 0
    47.       self.hp -= new_damage
    48.       return
    49.     elsif attacker.weapon_blessing?
    50.       @damage = -@damage - @damage * attacker.weapon_blessing / 100
    51.       dead_no_damage
    52.       self.hp -= @damage
    53.       return
    54.     elsif attacker.vampire_weapon?
    55.       attacker.vampire_weapon_hp_cost
    56.       dead_no_damage
    57.       self.hp -= @damage * attacker.vampire_weapon_dmg / 100
    58.     end
    59.   end
    60.   def dead_no_damage
    61.     @damage = 0 if self.maxhp == @hp
    62.   end
    63. end
    64. module GameBattlerTest
    65.   def actor?
    66.     @actor_id != nil
    67.   end
    68.   def enemy?
    69.     @enemy_id != nil
    70.   end
    71. end
    72. class Game_Actor
    73.   include GameBattlerTest
    74.   alias :kyon_weapon_dmg_gm_act_setup :setup
    75.   def setup(actor_id)
    76.     kyon_weapon_dmg_gm_act_setup(actor_id)
    77.     @weapon_use_sp = {}
    78.     @weapon_blessings = {}
    79.     @vampire_weapons = {}
    80.     @vampire_weapons.default = { :hp => 0, :dmg => 0 }
    81.   end
    82.   def weapon_sp_use(weapon_id, cost, percent)
    83.     @weapon_use_sp[weapon_id] = { :sp => cost, :percent => percent }
    84.   end
    85.   def weapon_no_sp(weapon_id)
    86.     @weapon_use_sp.delete(weapon_id)
    87.   end
    88.   def weapon_sp_cost
    89.     @weapon_use_sp[@weapon_id][:sp]
    90.   end
    91.   def weapon_sp_percent
    92.     @weapon_use_sp[@weapon_id][:percent]
    93.   end
    94.   def get_weapon_sp_cost
    95.     self.weapon_sp_cost * self.maxsp / 100
    96.   end
    97.   def clear_weapon_sp
    98.     @weapon_use_sp.clear
    99.   end
    100.   def weapon_sp_use?
    101.     @weapon_use_sp.has_key?(@weapon_id)
    102.   end
    103.   def bless_weapon(weapon_id, percent)
    104.     @weapon_blessings[weapon_id] = percent
    105.   end
    106.   def unbless_weapon(weapon_id)
    107.     @weapon_blessings.delete(weapon_id)
    108.   end
    109.   def weapon_blessing
    110.     @weapon_blessings[@weapon_id]
    111.   end
    112.   def clear_weapon_blessing
    113.     @weapon_blessings.clear
    114.   end
    115.   def weapon_blessing?
    116.     @weapon_blessings.has_key?(@weapon_id)
    117.   end
    118.   def vampire_weapon(weapon_id, hp_cost, dmg_percent)
    119.     @vampire_weapons[weapon_id] = { :hp => hp_cost, :dmg => dmg_percent }
    120.   end
    121.   def no_vampire_weapon(weapon_id)
    122.     @vampire_weapons.delete(weapon_id)
    123.   end
    124.   def clear_vampire_weapons
    125.     @vampire_weapons.clear
    126.   end
    127.   def vampire_weapon_hp_cost
    128.     self.hp -= @vampire_weapons[@weapon_id][:hp]
    129.   end
    130.   def vampire_weapon_dmg
    131.     @vampire_weapons[@weapon_id][:dmg]
    132.   end
    133.   def vampire_weapon?
    134.     @vampire_weapons.has_key?(@weapon_id)
    135.   end
    136.   attr_reader :weapon_use_sp, :weapon_blessings, :vampire_weapons
    137. end
    138. class Game_Enemy
    139.   include GameBattlerTest
    140.   def weapon_sp_use?() nil end
    141.   def weapon_blessing?() nil end
    142. end
    143. class Scene_Battle
    144.   alias :kyon_weapon_dmg_scn_btl_up_ph3_bsc_comm :update_phase3_basic_command
    145.   alias :kyon_weapon_dmg_scn_btl_mk_bsc_action_res :make_basic_action_result
    146.   def update_phase3_basic_command
    147.     if Input.trigger?(Input::C) and @actor_command_window.index == 0
    148.       $game_system.se_play($data_system.decision_se)
    149.       @active_battler.current_action.kind = 0
    150.       @active_battler.current_action.basic = 0
    151.       blessed = @active_battler.weapon_blessing?
    152.       blessed ? start_actor_select : start_enemy_select
    153.       return
    154.     end
    155.     kyon_weapon_dmg_scn_btl_up_ph3_bsc_comm
    156.   end
    157.   def make_altered_weapon_attack_result
    158.     return unless @active_battler.weapon_blessing?
    159.     @animation1_id = @active_battler.animation1_id
    160.     @animation2_id = @active_battler.animation2_id
    161.     if @active_battler.restriction == 3
    162.       target = $game_party.random_target_actor
    163.     elsif @active_battler.restriction == 2
    164.       target = $game_troop.random_target_enemy
    165.     else
    166.       index = @active_battler.current_action.target_index
    167.       target = $game_party.smooth_target_actor(index)
    168.     end
    169.     return unless target
    170.     target.attack_effect(@active_battler)
    171.     @target_battlers = [target]
    172.     true
    173.   end
    174.   
    175.   def make_basic_action_result
    176.     if @active_battler.current_action.basic == 0
    177.       if @active_battler.actor?
    178.         result = make_altered_weapon_attack_result
    179.         return if result
    180.       end
    181.     end
    182.     kyon_weapon_dmg_scn_btl_mk_bsc_action_res
    183.   end
    184. end
    复制代码



    Terms & Conditions

    Free for use in any game.
    Include my nickname in your game credits.
    Don't adopt any stray cats or blue squirrels or any kind of pokemon!
    That's it!


    本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/kweapondamage-xp.157604/

    本帖子中包含更多资源

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

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-27 07:07 , Processed in 0.118906 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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