Exemplo n.º 1
0
 protected void HandleLockInBeginning(ActiveMonster current, MultiEffect lockInEffect, ActiveMonster opponent)
 {
     if (current.SelectedMove.Effects.Any(e => e.Type == MoveEffectType.CancelEnemyMove))
     {
         OnSendMessage("{0}{1} can't move!", opponent.Trainer.MonNamePrefix, opponent.Monster.Name);
     }
     current.QueuedMove = current.SelectedMove;
     if (lockInEffect.Min == 2 && lockInEffect.Max == 5)
     {
         current.QueuedMoveLimit = new int[] { 2, 2, 2, 3, 3, 3, 4, 5 }
     }
 public static SoundEffect GetSubEffectFromMultiEffect(MultiEffect multiEffect, string id)
 {
     if (multiEffect != null && multiEffect.m_effects != null)
     {
         var subEffect = multiEffect.m_effects.FirstOrDefault(e => e.m_effect.name == id);
         if (subEffect.m_effect != null)
         {
             return(subEffect.m_effect as SoundEffect);
         }
     }
     return(null);
 }
        public static EffectInfo CreateEffectObject(Transform parent)
        {
            MultiEffect defaultMultiEffect = VehicleEffectsMod.FindEffect("Aircraft Movement") as MultiEffect;

            if (defaultMultiEffect != null)
            {
                MultiEffect newMultiEffect = GameObject.Instantiate(defaultMultiEffect);
                newMultiEffect.name = effectName;

                newMultiEffect.m_effects[0].m_effect = PropAircraftSound.CreateEffectObject(parent);

                return(newMultiEffect);
            }
            else
            {
                Logging.LogError("Could not find default plane movement effect!");
                return(null);
            }
        }
Exemplo n.º 4
0
        protected bool HandleDisableEffect(ActiveMonster current, ActiveMonster opponent)
        {
            if (opponent.DisabledCount > 0)
            {
                messageBuffer.AppendLine("But, it failed!");
                return(false);
            }
            else
            {
                Move[] enabled = opponent.Moves.Zip(opponent.CurrentPP, (move, pp) => new KeyValuePair <Move, int>(move, pp)).Where(p => p.Value > 0).Select(p => p.Key).ToArray();

                if (enabled.Length <= 0)
                {
                    messageBuffer.AppendLine("But, it failed!");
                    return(false);
                }
                else
                {
                    Move disabledMove = enabled[Rng.Next(0, enabled.Length)];

                    for (int i = 0; i < opponent.Moves.Length; i++)
                    {
                        if (opponent.Moves[i] == disabledMove)
                        {
                            opponent.DisabledMoveIndex = i;
                            break;
                        }
                    }

                    MultiEffect disableEffect = (MultiEffect)current.SelectedMove.Effects.Where(e => e.Type == MoveEffectType.Disable).First();

                    opponent.DisabledCount = Rng.Next(disableEffect.Min, disableEffect.Max + 1);

                    messageBuffer.AppendLine(string.Format("{0}{1}'s {2} was disabled!", opponent.Trainer.MonNamePrefix, opponent.Monster.Name, disabledMove.Name.ToUpper()));
                    return(true);
                }
            }
        }
Exemplo n.º 5
0
        public override SoundContainer GetSoundInstance()
        {
            CitizenInfo info = PrefabCollection <CitizenInfo> .FindLoaded(this.Id);

            if (info != null)
            {
                switch (this.Id)
                {
                case "Cow":
                case "Pig":
                    return(new SoundContainer(((LivestockAI)info.m_citizenAI).m_randomEffect as SoundEffect));

                case "Seagull":
                    MultiEffect effect = ((BirdAI)info.m_citizenAI).m_randomEffect as MultiEffect;
                    if (effect != null)
                    {
                        return(new SoundContainer(effect.m_effects.FirstOrDefault(e => e.m_effect.name == "Seagull Scream").m_effect as SoundEffect));
                    }
                    break;
                }
            }
            return(null);
        }
Exemplo n.º 6
0
        private static PatchResult DuplicateEffectAudioInfo(string effectId, string audioInfoId, MultiEffect effectContainer = null)
        {
            SoundEffect soundEffect = null;

            if (effectContainer != null)
            {
                soundEffect = effectContainer.m_effects.FirstOrDefault(e => e.m_effect.name == effectId).m_effect as SoundEffect;
            }
            else
            {
                soundEffect = EffectCollection.FindEffect(effectId) as SoundEffect;
            }

            if (soundEffect == null || soundEffect.m_audioInfo == null)
            {
                return(PatchResult.NotFound);
            }

            // Check if the AudioInfo object has our name, if not, we have to patch it.
            if (soundEffect.m_audioInfo.name != audioInfoId)
            {
                AudioInfo audioInfo = GameObject.Instantiate(soundEffect.m_audioInfo);
                audioInfo.name          = audioInfoId;
                soundEffect.m_audioInfo = audioInfo;
                return(PatchResult.Success);
            }
            return(PatchResult.AlreadyPatched);
        }