Esempio n. 1
0
    public void AdjustState(int howMuch)
    {
        if (!stateCanChange || howMuch == 0)
        {
            return;
        }                                                   // Don't bother with any of this if ambience cannot change
        AmbienceState oldState = GetState();

        // Change ambience score
        this.score += howMuch;

        // Make sure ambience score doesn't go outside thresholds, in case we try to shift the level towards Guarded when already Guarded (or towards Dangerous when already Dangerous)
        if (this.score < MIN_THRESHOLD)
        {
            this.score = MIN_THRESHOLD;
        }
        else if (this.score > MAX_THRESHOLD)
        {
            this.score = MAX_THRESHOLD;
        }

        if (oldState != GetState())         // If ambience state changes...
        {
            if (oldState > GetState())      // shifted towards diplomacy
            {
                shiftsToDiplomacyThisTurn += 1;
            }
            else        // shifted towards aggression
            {
                shiftsToAggressionThisTurn += 1;
            }
        }
    }
Esempio n. 2
0
    public override void Play(AbstractCharacter source, AbstractArgument target)
    {
        base.Play(source, target);
        AmbienceState state        = Ambience.Instance.GetState();
        bool          bonusEffects = (state == AmbienceState.GUARDED);
        int           multiplier   = (bonusEffects) ? 2 : 1;

        NegotiationManager.Instance.AddAction(new ApplyPoiseAction(source, target, POISE * multiplier));
    }
Esempio n. 3
0
    public override void Play(AbstractCharacter source, AbstractArgument target)
    {
        base.Play(source, target);
        AmbienceState state = Ambience.Instance.GetState();

        if (state == AmbienceState.GUARDED || state == AmbienceState.TENSE)
        {
            NegotiationManager.Instance.AddAction(new DrawCardsAction(source, DRAW));
        }
        NegotiationManager.Instance.AddAction(new DeployArgumentAction(source, new ArgumentAmbientShiftDialogue(), STACKS));
    }
Esempio n. 4
0
    public override void Play(AbstractCharacter source, AbstractArgument target)
    {
        base.Play(source, target);
        NegotiationManager.Instance.AddAction(new DamageAction(target, target.OWNER, MIN_DAMAGE, MAX_DAMAGE, this));

        AmbienceState curState = NegotiationManager.Instance.ambience.GetState();

        if (curState == AmbienceState.AGITATED || curState == AmbienceState.VOLATILE || curState == AmbienceState.DANGEROUS)
        {
            NegotiationManager.Instance.AddAction(new DeployArgumentAction(source, new ArgumentHeated(), STACKS));
        }
    }
Esempio n. 5
0
    public override int Resolve()
    {
        AmbienceState oldState = NegotiationManager.Instance.ambience.GetState();

        NegotiationManager.Instance.ambience.AdjustState(delta);
        AmbienceState newState = NegotiationManager.Instance.ambience.GetState();

        if (oldState != newState)
        {
            EventSystemManager.Instance.TriggerEvent(new EventAmbientStateShift(oldState, newState));
        }
        return(0);
    }
    public override void Play(AbstractCharacter source, AbstractArgument target)
    {
        base.Play(source, target);
        AmbienceState state        = Ambience.Instance.GetState();
        bool          bonusEffects = (state == AmbienceState.GUARDED || state == AmbienceState.TENSE);
        int           multiplier   = (bonusEffects) ? 2 : 1;

        NegotiationManager.Instance.AddAction(new DamageAction(target, target.OWNER, MIN_DAMAGE * multiplier, MAX_DAMAGE * multiplier, this));
        if (bonusEffects)
        {
            NegotiationManager.Instance.AddAction(new DeployArgumentAction(source, new ArgumentAmbientShiftAggression(), INFLUENCE));
        }
    }
Esempio n. 7
0
 private void LoadJson(AmbienceState state)
 {
     AmbienceSource[] componentsInChildren  = GetComponentsInChildren <AmbienceSource>();
     AmbienceZone[]   componentsInChildren2 = GetComponentsInChildren <AmbienceZone>();
     for (int i = 0; i < state.zones.Length; i++)
     {
         AmbienceZoneState ambienceZoneState = state.zones[i];
         foreach (AmbienceZone ambienceZone in componentsInChildren2)
         {
             if (!(ambienceZone.name == ambienceZoneState.name))
             {
                 continue;
             }
             ambienceZone.mainVerbLevel   = ambienceZoneState.mainVerbLevel;
             ambienceZone.musicLevel      = ambienceZoneState.musicLevel;
             ambienceZone.ambienceLevel   = ambienceZoneState.ambienceLevel;
             ambienceZone.effectsLevel    = ambienceZoneState.effectsLevel;
             ambienceZone.physicsLevel    = ambienceZoneState.physicsLevel;
             ambienceZone.characterLevel  = ambienceZoneState.characterLevel;
             ambienceZone.ambienceFxLevel = ambienceZoneState.ambienceFxLevel;
             if (ambienceZone.sources == null || ambienceZone.sources.Length != ambienceZoneState.sources.Length)
             {
                 ambienceZone.sources = new AmbienceSource[ambienceZoneState.sources.Length];
             }
             if (ambienceZone.volumes == null || ambienceZone.volumes.Length != ambienceZoneState.sources.Length)
             {
                 ambienceZone.volumes = new float[ambienceZoneState.sources.Length];
             }
             int num = 0;
             for (int k = 0; k < ambienceZoneState.sources.Length; k++)
             {
                 AmbienceZoneSourceState ambienceZoneSourceState = ambienceZoneState.sources[k];
                 foreach (AmbienceSource ambienceSource in componentsInChildren)
                 {
                     if (ambienceZoneSourceState.source == ambienceSource.name)
                     {
                         ambienceZone.sources[num] = ambienceSource;
                         ambienceZone.volumes[num] = ambienceZoneSourceState.volume;
                         num++;
                     }
                 }
             }
             if (num != ambienceZone.sources.Length)
             {
                 Array.Resize(ref ambienceZone.sources, num);
                 Array.Resize(ref ambienceZone.volumes, num);
             }
         }
     }
 }
Esempio n. 8
0
    public override void Play(AbstractCharacter source, AbstractArgument target)
    {
        base.Play(source, target);
        AmbienceState state = NegotiationManager.Instance.ambience.GetState();

        if (target.isCore || target.OWNER != this.OWNER)
        {
            throw new System.Exception("You must target friendly support arguments with Interrogate!");
        }
        int damageToDeal        = target.stacks * MULTIPLIER;
        AbstractCharacter enemy = TurnManager.Instance.GetOtherCharacter(target.OWNER);

        // Destroy sacrifical argument
        NegotiationManager.Instance.AddAction(new DestroyArgumentAction(target));

        // Damage enemy arguments
        NegotiationManager.Instance.AddAction(new DamageAction(enemy.GetCoreArgument(), enemy, damageToDeal, damageToDeal, this));
        NegotiationManager.Instance.AddAction(new DeployArgumentAction(this.OWNER, new ArgumentAmbientShiftAggression(), INFLUENCE));
    }
Esempio n. 9
0
        public void Save()
        {
            AmbienceSource[] componentsInChildren  = GetComponentsInChildren <AmbienceSource>();
            AmbienceZone[]   componentsInChildren2 = GetComponentsInChildren <AmbienceZone>();
            AmbienceState    ambienceState         = new AmbienceState();

            ambienceState.zones = new AmbienceZoneState[componentsInChildren2.Length];
            AmbienceState ambienceState2 = ambienceState;

            for (int i = 0; i < componentsInChildren2.Length; i++)
            {
                AmbienceZone ambienceZone = componentsInChildren2[i];
                ambienceState2.zones[i] = new AmbienceZoneState
                {
                    name            = ambienceZone.name,
                    sources         = new AmbienceZoneSourceState[ambienceZone.volumes.Length],
                    mainVerbLevel   = ambienceZone.mainVerbLevel,
                    musicLevel      = ambienceZone.musicLevel,
                    ambienceLevel   = ambienceZone.ambienceLevel,
                    effectsLevel    = ambienceZone.effectsLevel,
                    physicsLevel    = ambienceZone.physicsLevel,
                    characterLevel  = ambienceZone.characterLevel,
                    ambienceFxLevel = ambienceZone.ambienceFxLevel
                };
                for (int j = 0; j < ambienceZone.volumes.Length; j++)
                {
                    ambienceState2.zones[i].sources[j] = new AmbienceZoneSourceState
                    {
                        source = ambienceZone.sources[j].name,
                        volume = ambienceZone.volumes[j]
                    };
                }
            }
            string contents = JsonUtility.ToJson(ambienceState2, prettyPrint: true);
            string path     = GetPath();

            File.WriteAllText(path, contents);
        }
Esempio n. 10
0
        public void LoadJson(string json)
        {
            AmbienceState state = JsonUtility.FromJson <AmbienceState>(json);

            LoadJson(state);
        }
Esempio n. 11
0
 public void SetState(AmbienceState state)
 {
     this.score = (int)state;
 }
Esempio n. 12
0
 public SetAmbienceAction(AmbienceState state)
 {
     this.state = (int)state;
 }
Esempio n. 13
0
 ///<summary>
 ///Trigger when the ambience state shifts. Takes in an oldState (the previous ambience) and newState (the new ambience).
 ///</summary>
 public EventAmbientStateShift(AmbienceState oldState, AmbienceState newState)
 {
     this.type     = EventType.AMBIENCE_STATE_SHIFT;
     this.oldState = oldState;
     this.newState = newState;
 }