Ticket #2445: teambonus_withauras.diff

File teambonus_withauras.diff, 4.6 KB (added by fatherbushido, 8 years ago)

use global aura to implement team bonus

  • binaries/data/mods/public/simulation/components/Auras.js

    Auras.prototype.GetAffectedPlayers = fun  
    8484
    8585Auras.prototype.CalculateAffectedPlayers = function(name)
    8686{
    8787    var affectedPlayers = this.auras[name].affectedPlayers || ["Player"];
    8888    this.affectedPlayers[name] = [];
    89 
    90     var cmpPlayer = QueryOwnerInterface(this.entity);
     89    var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player);
     90    if (!cmpPlayer)
     91        cmpPlayer = QueryOwnerInterface(this.entity);
    9192    if (!cmpPlayer)
    9293        return;
    93 
    9494    var numPlayers = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetNumPlayers();
    9595    for (var i = 0; i < numPlayers; ++i)
    9696    {
    9797        for (let p of affectedPlayers)
    9898        {
    Auras.prototype.OnOwnershipChanged = fun  
    384384    this.Clean();
    385385};
    386386
    387387Auras.prototype.OnDiplomacyChanged = function(msg)
    388388{
    389     var cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership);
    390     if (cmpOwnership && cmpOwnership.GetOwner() == msg.player)
     389    var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player);
     390    if (cmpPlayer && cmpPlayer.GetPlayerID() == msg.player || IsOwnedByPlayer(msg.player, this.entity))
    391391        this.Clean();
    392392};
    393393
    394394Auras.prototype.OnGlobalResearchFinished = function(msg)
    395395{
    396     let cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership);
    397     if (!cmpOwnership || cmpOwnership.GetOwner() != msg.player)
     396    var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player);
     397    if ((!cmpPlayer || cmpPlayer.GetPlayerID() != msg.player) && !IsOwnedByPlayer(msg.player, this.entity))
    398398        return;
    399399    let auraNames = this.GetAuraNames();
    400400    let needsClean = false;
    401401    for (let name of auraNames)
    402402    {
  • binaries/data/mods/public/simulation/data/auras/iber_player_teambonus.json

     
     1{
     2    "type": "global",
     3    "affects": ["CitizenSoldier Javelin"],
     4    "affectedPlayers": ["ExclusiveMutualAlly"],
     5    "modifications": [
     6        { "value": "Cost/Resources/food", "multiply": 0.8 },
     7        { "value": "Cost/Resources/wood", "multiply": 0.8 },
     8        { "value": "Cost/Resources/metal", "multiply": 0.8 },
     9        { "value": "Cost/Resources/stone", "multiply": 0.8 }
     10    ],
     11    "auraName": "Saripeko",
     12    "auraDescription": "Reduces the cost for citizen-soldier skirmishers with 20% for allies of Iberian players"
     13}
  • binaries/data/mods/public/simulation/data/auras/sele_player_teambonus.json

     
     1{
     2    "type": "global",
     3    "affects": ["CivilCentre"],
     4    "affectedPlayers": ["MutualAlly"],
     5    "modifications": [
     6        { "value": "Cost/Resources/food", "multiply": 0.8 },
     7        { "value": "Cost/Resources/wood", "multiply": 0.8 },
     8        { "value": "Cost/Resources/metal", "multiply": 0.8 },
     9        { "value": "Cost/Resources/stone", "multiply": 0.8 }
     10    ],
     11    "auraName": "Syryan Tetrapolis",
     12    "auraDescription": "Reduces the cost for civil centers with 20% for allies of Seleucid players"
     13}
  • binaries/data/mods/public/simulation/templates/special/player_iber.xml

     
     1<?xml version="1.0" encoding="utf-8"?>
     2<Entity parent="special/player">
     3  <Auras datatype="tokens">iber_player_teambonus</Auras>
     4</Entity>
  • binaries/data/mods/public/simulation/templates/special/player_sele.xml

     
    11<?xml version="1.0" encoding="utf-8"?>
    22<Entity parent="special/player">
     3  <Auras datatype="tokens">sele_player_teambonus</Auras>
    34  <EntityLimits>
    45    <LimitRemovers>
    56      <CivilCentre>
    67        <RequiredTechs datatype="tokens">phase_town</RequiredTechs>
    78        <RequiredClasses datatype="tokens">Hero</RequiredClasses>