PVP rules for bind zone alignment (PVPType = 1) or SetAlignment from lua (PVPType = 2)
This commit is contained in:
parent
70c9fd0124
commit
63062737ac
@ -144,6 +144,7 @@ bool Entity::AttackAllowed(Entity* target, float distance, bool range_attack) {
|
||||
if (attacker->IsPlayer() && target->IsPlayer())
|
||||
{
|
||||
bool pvp_allowed = rule_manager.GetZoneRule(GetZoneID(), R_PVP, AllowPVP)->GetBool();
|
||||
int32 pvp_type = rule_manager.GetZoneRule(GetZoneID(), R_PVP, PVPType)->GetInt32();
|
||||
if (!pvp_allowed) {
|
||||
LogWrite(COMBAT__DEBUG, 3, "AttackAllowed", "Failed to attack: pvp is not allowed");
|
||||
return false;
|
||||
@ -158,6 +159,19 @@ bool Entity::AttackAllowed(Entity* target, float distance, bool range_attack) {
|
||||
LogWrite(COMBAT__DEBUG, 3, "AttackAllowed", "Failed to attack: pvp range of %i exceeded abs(%i-%i).", pvpLevelRange, attackerLevel, defenderLevel);
|
||||
return false;
|
||||
}
|
||||
switch(pvp_type) {
|
||||
// 0 = FFA, skip these checks
|
||||
case 1: {
|
||||
if(((Player*)attacker)->GetPVPAlignment() == ((Player*)target)->GetPVPAlignment())
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
if(attacker->GetInfoStruct()->get_alignment() == target->GetInfoStruct()->get_alignment())
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,6 +248,7 @@ void RuleManager::Init()
|
||||
RULE_INIT(R_PVP, LevelRange, "4");
|
||||
RULE_INIT(R_PVP, InvisPlayerDiscoveryRange, "20"); // value > 0 sets radius inner to see, = 0 means always seen, -1 = never seen
|
||||
RULE_INIT(R_PVP, PVPMitigationModByLevel, "25"); // gives a bonus to mitigation for PVP combat to offset the percentage level * mod (default 25)
|
||||
RULE_INIT(R_PVP, PVPType, "0"); // 0 = FFA, 1 = PVPAlignment (Bind zone), 2 = Alignment (assigned via LUA function SetAlignment)
|
||||
|
||||
/* COMBAT */
|
||||
RULE_INIT(R_Combat, MaxCombatRange, "4.0");
|
||||
|
@ -107,6 +107,7 @@ enum RuleType {
|
||||
LevelRange,
|
||||
InvisPlayerDiscoveryRange,
|
||||
PVPMitigationModByLevel,
|
||||
PVPType,
|
||||
|
||||
/* COMBAT */
|
||||
MaxCombatRange,
|
||||
|
Loading…
x
Reference in New Issue
Block a user