FBE Group Defeat Loot (YEP State Categories extension) v1.01
by FeatherBrain
Introduction
Extension for Yanfly's YEP State Categories plugin so enemies with the <Group Defeat> category leave loot at the end of battle.
Features
YEP State Categories contains a <Group Defeat> notetag. If all group members are afflicted by states that have this notetag, it is considered a lost battle.
However, by default, enemies that are in this "group defeat" category do not yield any loot (experience, gold, or items) when the battle ends.
This plugin extension modifies the Game_Troop functions related to experience, gold, and items so that enemies who are in a "Group Defeat" state at the end of battle DO yield experience, gold, and items, just as they would if they were in the regular "dead" state.
Plugin also supports Yanfly's Job Points plugin. Enemies in a "Group Defeat" state at the end of battle will reward Job Points appropriately.
Terms of Use
Free for any use. Credit "FeatherBrain Entertainment" if you want.
Compatibility
Requires YEP State Categories. Place this plugin beneath State Categories and Job Points (if using).
No known incompatibilities, please report any issues to this thread.
Update History
* v1.0 - initial release
* v1.01 - added support for Yanfly's Job Points plugin
JavaScript:
- //=============================================================================
- // FBE_GroupDefeatLoot.js
- //=============================================================================
- /*:
- * @plugindesc v1.01 Extension for Yanfly's YEP State Categories plugin so enemies with the <Group Defeat> category leave loot at the end of battle.
- *
- * @author FeatherBrain Entertainment
- *
- * @help
- *
- * Purpose/Use:
- *
- * YEP State Categories contains a <Group Defeat> notetag. If all group members
- * are afflicted by states that have this notetag, it is considered a lost battle.
- * However, by default, enemies that are in this "group defeat" category do not
- * yield any loot (experience, gold, or items) when the battle ends.
- *
- * This plugin extension modifies the Game_Troop functions related to experience,
- * gold, and items so that enemies who are in a "Group Defeat" state at the end
- * of battle DO yield experience, gold, and items, just as they would if they
- * were in the regular "dead" state.
- *
- * Plugin also supports Yanfly's Job Points plugin. Enemies in a "Group Defeat"
- * state at the end of battle will reward Job Points appropriately.
- *
- * TERMS OF USE
- * Free for any use. Credit FeatherBrain Entertainment if you want.
- *
- * COMPATIBILITY
- * Requires YEP State Categories. Place this plugin beneath State Categories
- * and Job Points (if using).
- *
- * UPDATE HISTORY
- * v1.0 - initial release
- * v1.01 - added support for Yanfly's Job Points plugin
- *
- */
- //============================================================================
-
- (function() {
- //-----------------------------------------------------------------------------
- // Game_Unit
- //
- // The superclass of Game_Party and Game_Troop.
- Game_Unit.prototype.groupDefeatMembers = function() {
- return this.members().filter(function(member) {
- return member.isGroupDefeatAffected();
- });
- };
- //-----------------------------------------------------------------------------
- // Game_Troop
- //
- // The game object class for a troop and the battle-related data.
- var FBE_Game_Troop_expTotal = Game_Troop.prototype.expTotal;
- Game_Troop.prototype.expTotal = function() {
- var deadMemberExp = FBE_Game_Troop_expTotal.call(this);
- var groupDefeatExp = this.groupDefeatMembers().reduce(function(r, enemy) {
- return r + enemy.exp();
- }, 0);
- return deadMemberExp + groupDefeatExp;
- };
- var FBE_Game_Troop_goldTotal = Game_Troop.prototype.goldTotal;
- Game_Troop.prototype.goldTotal = function() {
- var deadMemberGold = FBE_Game_Troop_goldTotal.call(this);
- var groupDefeatGold = this.groupDefeatMembers().reduce(function(r, enemy) {
- return r + enemy.gold();
- }, 0) * this.goldRate();
- return deadMemberGold + groupDefeatGold;
- };
- var FBE_Game_Troop_makeDropItems = Game_Troop.prototype.makeDropItems;
- Game_Troop.prototype.makeDropItems = function() {
- var deadMemberItems = FBE_Game_Troop_makeDropItems.call(this);
- var groupDefeatItems = this.groupDefeatMembers().reduce(function(r, enemy) {
- return r.concat(enemy.makeDropItems());
- }, []);
- return groupDefeatItems.concat(deadMemberItems);
- };
- var FBE_Game_Troop_jpTotal = Game_Troop.prototype.jpTotal;
- Game_Troop.prototype.jpTotal = function() {
- var deadMemberJP = FBE_Game_Troop_jpTotal.call(this);
- var groupDefeatJP = this.groupDefeatMembers().reduce(function(r, enemy) {
- return r + enemy.jp();
- }, 0);
- return deadMemberJP + groupDefeatJP;
- };
-
- })();
复制代码
本贴来自国际rpgmaker官方论坛作者:Featherbrain处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/group-defeat-loot-yanfly-yep-state-categories-extension.127663/