Ticket #2445: teambonus_withauras.7.diff

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

add delian league teambonus

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

    Auras.prototype.GetAffectedPlayers = fun  
    8585Auras.prototype.CalculateAffectedPlayers = function(name)
    8686{
    8787    var affectedPlayers = this.auras[name].affectedPlayers || ["Player"];
    8888    this.affectedPlayers[name] = [];
    8989
    90     var cmpPlayer = QueryOwnerInterface(this.entity);
     90    var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player);
     91    if (!cmpPlayer)
     92        cmpPlayer = QueryOwnerInterface(this.entity);
    9193    if (!cmpPlayer)
    9294        return;
    9395
    9496    var numPlayers = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetNumPlayers();
    9597    for (var i = 0; i < numPlayers; ++i)
    Auras.prototype.OnOwnershipChanged = fun  
    384386    this.Clean();
    385387};
    386388
    387389Auras.prototype.OnDiplomacyChanged = function(msg)
    388390{
    389     var cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership);
    390     if (cmpOwnership && cmpOwnership.GetOwner() == msg.player)
     391    var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player);
     392    if (cmpPlayer && (cmpPlayer.GetPlayerID() == msg.player || cmpPlayer.GetPlayerID() == msg.otherPlayer) ||
     393       IsOwnedByPlayer(msg.player, this.entity) ||
     394       IsOwnedByPlayer(msg.otherPlayer, this.entity))
    391395        this.Clean();
    392396};
    393397
    394398Auras.prototype.OnGlobalResearchFinished = function(msg)
    395399{
    396     let cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership);
    397     if (!cmpOwnership || cmpOwnership.GetOwner() != msg.player)
     400    var cmpPlayer = Engine.QueryInterface(this.entity, IID_Player);
     401    if ((!cmpPlayer || cmpPlayer.GetPlayerID() != msg.player) && !IsOwnedByPlayer(msg.player, this.entity))
    398402        return;
    399403    let auraNames = this.GetAuraNames();
    400404    let needsClean = false;
    401405    for (let name of auraNames)
    402406    {
  • binaries/data/mods/public/simulation/components/Player.js

    Player.prototype.SetTeam = function(team  
    387387
    388388            this.SetAlly(i);
    389389            cmpPlayer.SetAlly(this.playerID);
    390390        }
    391391
    392     Engine.BroadcastMessage(MT_DiplomacyChanged, { "player": this.playerID });
     392    Engine.BroadcastMessage(MT_DiplomacyChanged, { "player": this.playerID, "otherPlayer": null });
    393393};
    394394
    395395Player.prototype.SetLockTeams = function(value)
    396396{
    397397    this.teamsLocked = value;
    Player.prototype.GetDiplomacy = function  
    408408};
    409409
    410410Player.prototype.SetDiplomacy = function(dipl)
    411411{
    412412    this.diplomacy = dipl;
    413     Engine.BroadcastMessage(MT_DiplomacyChanged, { "player": this.playerID });
     413    Engine.BroadcastMessage(MT_DiplomacyChanged, { "player": this.playerID, "otherPlayer": null });
    414414};
    415415
    416416Player.prototype.SetDiplomacyIndex = function(idx, value)
    417417{
    418418    var cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager);
    Player.prototype.SetDiplomacyIndex = fun  
    425425
    426426    if (this.state != "active" || cmpPlayer.state != "active")
    427427        return;
    428428
    429429    this.diplomacy[idx] = value;
    430     Engine.BroadcastMessage(MT_DiplomacyChanged, { "player": this.playerID });
     430    Engine.BroadcastMessage(MT_DiplomacyChanged, { "player": this.playerID, "otherPlayer": cmpPlayer.GetPlayerID() });
    431431
    432432    // Mutual worsening of relations
    433433    if (cmpPlayer.diplomacy[this.playerID] > value)
    434434        cmpPlayer.SetDiplomacyIndex(this.playerID, value);
    435435};
  • binaries/data/mods/public/simulation/data/technologies/hellenes/teambonus_athen_delian_league.json

     
    1 {
    2     "genericName": "Delian League",
    3     "autoResearch": true,
    4     "description": "Shortly after the great naval victories at Salamis and Mycale, the Greek city-states instituted the so-called Delian League in 478 BC, whose purpose was to push the Persians out of the Aegean region. The allied states contributed ships and money, while the Athenians offered their entire navy.",
    5     "requirements": {"civ": "athen"},
    6     "modifications": [{"value": "Cost/BuildTime", "multiply": 0.75}],
    7     "affects": ["Warship"]
    8 }
    9  Pas de fin de ligne à la fin du fichier
  • binaries/data/mods/public/simulation/templates/special/player_athen.xml

    Modification de propriétés sur binaries/data/mods/public/simulation/data/technologies/hellenes/teambonus_athen_delian_league.json
    ___________________________________________________________________
    Deleted: svn:eol-style
    ## -1 +0,0 ##
    -native
    \ No newline at end of property
     
     1<?xml version="1.0" encoding="utf-8"?>
     2<Entity parent="special/player">
     3  <Auras datatype="tokens">teambonuses/athen_player_teambonus</Auras>
     4</Entity>
  • 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">teambonuses/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">teambonuses/sele_player_teambonus</Auras>
    34  <EntityLimits>
    45    <LimitRemovers>
    56      <CivilCentre>
    67        <RequiredTechs datatype="tokens">phase_town</RequiredTechs>
    78        <RequiredClasses datatype="tokens">Hero</RequiredClasses>