public override bool IsConcernedByEvent(Event gameEvent, Army army)
    {
        if (army == null || army.Empire == null)
        {
            return(false);
        }
        if (!army.Empire.SimulationObject.Tags.Contains("FactionTraitAffinityStrategic"))
        {
            return(false);
        }
        EventBoosterStarted eventBoosterStarted = gameEvent as EventBoosterStarted;

        if (eventBoosterStarted != null && eventBoosterStarted.Empire == army.Empire && eventBoosterStarted.Booster.BoosterDefinition.Name.ToString().StartsWith("BoosterStrategic"))
        {
            return(true);
        }
        EventBoosterEnded eventBoosterEnded = gameEvent as EventBoosterEnded;

        if (eventBoosterEnded != null && eventBoosterEnded.Empire == army.Empire && eventBoosterEnded.BoosterDefinition.Name.ToString().StartsWith("BoosterStrategic"))
        {
            return(true);
        }
        EventColonize eventColonize = gameEvent as EventColonize;

        if (eventColonize != null && eventColonize.Empire == army.Empire)
        {
            return(true);
        }
        EventSwapCity eventSwapCity = gameEvent as EventSwapCity;

        return((eventSwapCity != null && eventSwapCity.Empire == army.Empire) || base.IsConcernedByEvent(gameEvent, army));
    }
    public override bool IsConcernedByEvent(Event gameEvent, Army army)
    {
        if (army == null || army.Empire == null)
        {
            return(false);
        }
        if (!army.Empire.SimulationObject.Tags.Contains("FactionTraitAffinityStrategic"))
        {
            return(false);
        }
        EventDiplomaticRelationStateChange eventDiplomaticRelationStateChange = gameEvent as EventDiplomaticRelationStateChange;

        if (eventDiplomaticRelationStateChange != null && eventDiplomaticRelationStateChange.Empire == army.Empire && eventDiplomaticRelationStateChange.DiplomaticRelationStateName != DiplomaticRelationState.Names.Unknown)
        {
            return(true);
        }
        EventDiplomaticContractStateChange eventDiplomaticContractStateChange = gameEvent as EventDiplomaticContractStateChange;

        if (eventDiplomaticContractStateChange != null && eventDiplomaticContractStateChange.DiplomaticContract != null && (eventDiplomaticContractStateChange.DiplomaticContract.EmpireWhichProposes == army.Empire || eventDiplomaticContractStateChange.DiplomaticContract.EmpireWhichReceives == army.Empire) && eventDiplomaticContractStateChange.DiplomaticContract.State == DiplomaticContractState.Signed)
        {
            return(true);
        }
        EventSwapCity eventSwapCity = gameEvent as EventSwapCity;

        return((eventSwapCity != null && eventSwapCity.Empire == army.Empire) || base.IsConcernedByEvent(gameEvent, army));
    }
Exemple #3
0
    public override bool IsConcernedByEvent(Event gameEvent, Army army)
    {
        if (army == null || army.Empire == null)
        {
            return(false);
        }
        EventSwapCity eventSwapCity = gameEvent as EventSwapCity;

        return((eventSwapCity != null && eventSwapCity.Empire.Index == army.Empire.Index) || base.IsConcernedByEvent(gameEvent, army));
    }
    protected void EventService_EventRaise(object sender, EventRaiseEventArgs e)
    {
        bool isHosting = Services.GetService <ISessionService>().Session.IsHosting;

        if (e.RaisedEvent is EventSwapCity)
        {
            EventSwapCity eventSwapCity = e.RaisedEvent as EventSwapCity;
            if (isHosting)
            {
                this.CheckVictoryQuestForEmpire(base.Game.Empires[eventSwapCity.OldOwnerEmpireIndex]);
                return;
            }
        }
        else if (e.RaisedEvent is EventSettlerDied)
        {
            Empire empire = (e.RaisedEvent as EventSettlerDied).Empire as Empire;
            if (empire != null && empire is MajorEmpire && isHosting)
            {
                this.CheckVictoryQuestForEmpire(empire);
            }
        }
    }