我正在编辑视频游戏的某些文件,并且有一个称为battle_check_target
的功能,它确定玩家可以攻击的人。
battle_check_target
//which has these definitions set for it
BCT_NOONE = 0x000000, ///< No one
BCT_SELF = 0x010000, ///< Self
BCT_ENEMY = 0x020000, ///< Enemy
BCT_PARTY = 0x040000, ///< Party members
BCT_GUILDALLY = 0x080000, ///< Only allies, NOT guildmates
BCT_NEUTRAL = 0x100000, ///< Neutral target
BCT_SAMEGUILD = 0x200000, ///< Guildmates, No Guild Allies
BCT_ALL = 0x3F0000, ///< All targets
BCT_WOS = 0x400000, ///< Except self (currently used for skipping if src == bl in skill_area_sub)
BCT_GUILD = BCT_SAMEGUILD|BCT_GUILDALLY, ///< Guild AND Allies (BCT_SAMEGUILD|BCT_GUILDALLY)
BCT_NOGUILD = BCT_ALL&~BCT_GUILD, ///< Except guildmates
BCT_NOPARTY = BCT_ALL&~BCT_PARTY, ///< Except party members
BCT_NOENEMY = BCT_ALL&~BCT_ENEMY, ///< Except enemy
BCT_ALLY = BCT_PARTY|BCT_GUILD,
BCT_FRIEND = BCT_NOENEMY,
BCT_CLAN = BCT_SAMECLAN|BCT_CLANALLY ///< **What I added**
玩家,敌人,您的公会,您的队伍等
[游戏中还有一个称为氏族的系统,其作用类似于公会和政党。就像公会一样,氏族有氏族和氏族盟友。他们不能互相攻击,这就是为什么我要像这样添加氏族定义:
BCT_SAMECLAN = 0x300000, ///< Clanmates
BCT_CLANALLY = 0x280000, ///< Clan allies
然后将它们放在确定谁可以攻击谁的条件语句中:
if( !state ) //If not an enemy, nor a guild, nor party, nor yourself, it's neutral.
state = BCT_NEUTRAL;
//Alliance state takes precedence over enemy one.
else if( state&BCT_ENEMY && strip_enemy && state&(BCT_SELF|BCT_PARTY|BCT_GUILD|**BCT_CLAN**) )
state&=~BCT_ENEMY;
return (flag&state)?1:-1;
}
///> I also added the **BCT_CLAN**
我相信这些值(例如0x000000)是一些32位类型的值,它确定鼠标播放器将鼠标悬停在什么位置?此代码是服务器端的代码,因此它向客户端发送有关如何使鼠标光标等的响应。
我的问题是,我将如何找出这些价值是什么?您在.exe中寻找的东西吗?我检查了每隔一个.cpp和.hpp文件,并且能够在任何地方找到该值。有谁知道我应该去哪里?
跳过尾随0以进行解释。
这些值是位的标志:
Name | hex | binary
BCT_NOONE | 0x00 | 0b0000'0000 ///< No one
BCT_SELF | 0x01 | 0b0000'0001 ///< Self
BCT_ENEMY | 0x02 | 0b0000'0010 ///< Enemy
BCT_PARTY | 0x04 | 0b0000'0100 ///< Party members
BCT_GUILDALLY | 0x08 | 0b0000'1000 ///< Only allies, NOT guildmates
BCT_NEUTRAL | 0x10 | 0b0001'0000 ///< Neutral target
BCT_SAMEGUILD | 0x20 | 0b0010'0000 ///< Guildmates, No Guild Allies
BCT_ALL | 0x3F | 0b0011'1111 ///< All targets
BCT_WOS | 0x40 | 0b0100'0000 ///< Except self (currently used for skipping if src == bl in skill_area_sub)
// Dependent values
BCT_GUILD | 0x28 | 0b0010'1000 // BCT_SAMEGUILD|BCT_GUILDALLY, ///< Guild AND Allies
BCT_NOGUILD | 0x17 | 0b0001'0111 // BCT_ALL&~BCT_GUILD, ///< Except guildmates
BCT_NOPARTY | 0x3B | 0b0011'1011 // BCT_ALL&~BCT_PARTY, ///< Except party members
BCT_NOENEMY | 0x3D | 0b0011'1101 // BCT_ALL&~BCT_ENEMY, ///< Except enemy
BCT_ALLY | 0x2C | 0b0010'1100 // BCT_PARTY|BCT_GUILD,
BCT_FRIEND | 0x3D | 0b0011'1011 // BCT_NOENEMY,
您添加:
BCT_SAMECLAN | 0x30 | 0b0011'0000 ///< Expected Clanmates, but same as Same guild or neutral
BCT_CLANALLY | 0x28 | 0b0010'1000 ///< Expected Clan allies, but same as Same guild or guild ally
BCT_CLAN | 0x38 | 0b0011'1000 // BCT_SAMECLAN|BCT_CLANALLY ///< -> Guild or Neutral
哪个更聪明不是您想要的
以及示例代码:
if (!state) //If not an enemy, nor a guild, nor party, nor yourself, it's neutral.
state = BCT_NEUTRAL;
//Alliance state takes precedence over enemy one.
else if ( (state & BCT_ENEMY) // Has ENEMY flag
&& strip_enemy
&& state & (BCT_SELF // Is self
| BCT_PARTY // or party member
| BCT_GUILD // or same guild or ally guild
| BCT_CLAN /*Added*/) // or guild(same as above) or neutral
)
state &= ~BCT_ENEMY; // Remove ENEMY flag
return (flag & state) ? 1 : -1; // Do they share at least one common "property"?
想法是要添加/更改:
BCT_ALL | 0x01BF | 0b0000'0001'1011'1111 ///< All targets including clans
BCT_SAME_CLAN | 0x0080 | 0b0000'0000'1000'0000
BCT_CLAN_ALLY | 0x0100 | 0b0000'0001'0000'0000
但是,在您的情况下,结尾的0使我觉得多余的位已经用于其他用途了……因此不必添加新的属性。
您还必须将这些标志正确设置为变量...