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

[转载发布] Shield

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

    连续签到: 2 天

    [LV.7]常住居民III

    7927

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 9 小时前 | 显示全部楼层 |阅读模式
    Shield
    Author: Vyndicate


    This will add shield feature into the battle
    The UI a bit messy because I'm not really pro about it. But mostly it's functional

    The gauge is based on ally available shield / max hp. Currently only for allies. Party, Troop, and Enemies will not have gauge and they will have text instead

    Skill Notetag:
    <Shield: x>
    <Shield: formula>
    Gain of x amount of shield for each target
    You can put either flat amount or using formula with a is user and b is target

    <Team Shield: x>
    <Team Shield: formula>
    Gain of x amount of shield for team, either troop or party
    You can put either flat amount or using formula with a is user and b is target

    <Target Shield: x>
    Target you want to add shield using scope from game + additional scope

    Scope from game:
    0: None
    1: 1 Enemy
    2: All Enemies
    3: 1 Random Enemy
    4: 2 Random Enemies
    5: 3 Random Enemies
    6: 4 Random Enemies
    7: 1 Ally
    8: All Allies
    9: 1 Ally (Dead)
    10: All Allies (Dead)
    11: User

    Additional Scope:
    12: All Allies (Excluding User)
    13: Team (Either Party or Troop)

    Available to use Target Shield Notetag => 2, 8, 11, 12, 13

    Scope 13 is for gainTeamShield only

    If using number other that mentioned above, it will use default scope from
    what database has been set

    <Shield Drain: x>
    When using skill to damage, it will drain some of the shield from opponent to user or any ally targeted scope. Number is percentage, x is value from 0 to 100. If you put more than 100, it will more than 100% technically

    <Pierce: x>
    When using skill to damage, it will bypass the damage straight to decrease H instead of decrease shield. Number is percentage, x is value from 0 to 100.  If you put more than 100, it will more than 100% technically

    State Notetag:
    <Block Shield>
    Using this in state will block all shield that gain with positive value, including from drain shield
    Negative value or getting damage by opponents will not affected by this

    YEP_X_ActSeqPack1:
    You can use inside action sequence provided by Yanfly Plugin Action Sequence Pack 1
    =============================================================================
    ADD SHIELD: (target), (value)
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Add the amount of value to desired target. Target is same as what mentioned in YEP_X_ActSeqPack1. The value can be either flat number or formula with a is user and b is target
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Usage Example: add shield: actors, 300
                   add shield: enemies, b.mhp / 4
                   add shield: all members, a.atk * 2
    =============================================================================
    ADD (PARTY/TROOP) TEAM SHIELD: (value), true/false
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Add the amount of value to either for party or troop. The value can be either flat number or formula with a is user and b is alive member of the team. Set true if you want to calculate only from user without other party members. It will set to false if using flat number or not write the boolean value
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Usage Example: add party team shield: 250
                   add troop team shield: b.mhp / 4, false
                   add party team shield: a.mhp / 2, true =============================================================================

    Script Calls:
    You can directly call through script call. The available functions are:
    1. (actor/enemy).getShield()
    复制代码
    Get current shield of character
    1. (actor/enemy).setShield(value)
    复制代码
    Adjust shield of character
    1. (actor/enemy).addShield(value)
    复制代码
    Add shield of character. Value can be negative
    Minimum value result is 0
    1. (actor/enemy).removeShield(value)
    复制代码
    Remove shield of character
    Minimum value result is 0
    1. (party/troop).getTeamShield()
    复制代码
    Get current team shield of party or troop
    1. (party/troop).setTeamShield(value)
    复制代码
    Adjust team shield of party or troop
    1. (party/troop).addTeamShield(value)
    复制代码
    Add team shield of party or troop. Value can be negative
    Minimum value result is 0
    1. (party/troop).removeTeamShield(value)
    复制代码
    Remove team shield of party or troop
    Minimum value result is 0
    1. (actor/enemy).shieldRate()
    复制代码
    Get current shield rate of character. It will return based on current shield / max hp. In code, mostly used for gauge display
    Return between 0 to 1
    To make it percentage. You can use like this"
    1. Math.floor(actor.shieldRate() * 100)
    复制代码
    use + "%" if you want to make it display
    1. (actor/enemy).shieldRateWithoutLimit()
    复制代码
    Same as above, but it will show more than 1 instead
    between 0 and 1

    From predefined variables, can be used anywhere when script call is allowed, including for debuging:
    $gameParty.setTeamShield(value);
    $gameParty.getTeamShield();
    $gameTroop.setTeamShield(value);
    $gameTroop.getTeamShield();
    $gameActors.actor(id).setShield(value);
    $gameActors.actor(id).getShield();
    $gameTroop.aliveMembers()[index].setShield(value);
    $gameTroop.aliveMembers()[index].getShield();
    $gameActors.actor(id).shieldRate();
    $gameActors.actor(id).shieldRateWithoutLimit();
    $gameTroop.aliveMembers()[index].shieldRate();
    $gameTroop.aliveMembers()[index].shieldRateWithoutLimit();

    Enemy doesn't have predefined variable, so it needs to called through $gameTroop and do either a loop or direct index call
    The function of enemy list can be anything like allMembers(), members(), aliveMembers(), etc

    From damage formula:
    a.getShield()
    b.getShield()
    a.removeShield(value)
    b.removeShield(value)

    Example:
    a.atk * 4 - b.def * 2 + a.getShield() / 2
    a.atk * 4 - b.def * 2; b.removeShield(a.atk * 3)

    From eval on Yanfly. This might be very rare situation, but can be very useful too:
    this._action.subject().getShield()
    "this" is refer to BattleManager
    _action is currently doing action
    subject is the user who use it
    Example
    <target action>
       eval: $gameVariables.setValue(1, this._action.subject().getShield() * 2);
    </target action>
    ============================================================================
    You can also set it to variables or switch depend on what your need
    $gameVariables.setValue(1, $gameActors.actor(id).getShield());
    $gameSwitches.setValue(1, $gameTroop.aliveMembers()[index].getShield() > 0);

    Note: You can adjust the code as you desire. The shield calculation should be work as intended

    Terms of Use:
    Free for commercial and non commercial use with credits

    Changelog
    v1.1.5
    Fix static number value cause NaN error
    Fix shield will not retain if the battler has shield, killed, and revived from death
    Add block shield state notetag, prevent gain positive shield

    v1.1.4
    Add shieldRateWithoutLimit()
    Add complete description
    Add new parameter, display with percentage or not. Only used for actors and enemies

    v1.1.1
    Prevent wrong value for Boolean type and fix troop position shield text

    v1.1.0
    Add YEP_X_ActSeqPack1 compatibility

    v1.0.2
    Prevent negative shield

    v1.0.1
    Add battle end reset option

    v1.0.0
    Init plugin

    Showcase:





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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-7-31 21:41 , Processed in 0.120690 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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