Beispiel #1
0
        public Turban(float x, float y, Team t) : base(x, y, t)
        {
            //This code is pretty much just for (possible) cases where the hat isn't equipped.
            TurbanData td = TurbanData.find(this.sprite.texture.textureIndex);

            if (td != null)
            {
                //_tdata = td;
                //this.team = t;
                setquack(td.QuackPaths, td.RareQuackPaths);
            }
        }
Beispiel #2
0
        public override void Equip(Duck d)
        {
            TurbanData td = TurbanData.find(this.sprite.texture.textureIndex);

            if (td != null)
            {
                //_tdata = td;
                //this.team = t;
                setquack(td.QuackPaths, td.RareQuackPaths);
            }
            base.Equip(d);
        }
Beispiel #3
0
        public static Turban findHat(TeamHat th)
        {
            TurbanData td = find(th.sprite.texture.textureIndex);

            if (td != null)
            {
                return(new Turban(th.x, th.y, th.team));
            }
            return(null);

            /*
             * foreach (TurbanData td in turbans)
             * {
             *  if (td.isHat(th)) return new Turban(th.x, th.y, th.team);
             *      //return new Turban(th.x, th.y, th.team, td);
             * }
             * return null;*/
        }
Beispiel #4
0
        public void Update()
        {
            //some basic error checking
            if (Level.current == null ||
                Steam.user == null)
            {
                return;
            }

            //fancy SFX replacement. yeah yeah, it's per frame, whatever. deal with it.
            if (ModSettings.enableDangerousInjections)
            {
                foreach (KeyValuePair <string, Tuple <float, string>[]> entry in _sfxr)
                {
                    if (entry.Value.Length > 0)
                    {
                        bool changed = false;
                        foreach (Tuple <float, string> val in entry.Value)
                        {
                            //no breaking is done intentionally. later entries have priority.
                            if (Rando.Float(0.0f, 1.0f) < val.Item1)
                            {
                                _sounds[entry.Key] = _sounds[val.Item2];
                                changed            = true;
                            }
                        }
                        //if not changed, reset to default
                        if (!changed)
                        {
                            _sounds[entry.Key] = _sounds_bak[entry.Key];
                        }
                    }
                }
            }


            //hat replacement
            if (!(Level.current is Editor))
            {
                IEnumerable <Thing> teamHatList = Level.current.things[typeof(TeamHat)];
                //int nhats = 0;
                foreach (TeamHat teamHat in teamHatList)
                {
                    //nhats++;
                    if (teamHat.team != null && teamHat.team.customData == null && teamHat.team.hasHat)
                    {
                        if (!(teamHat is EdoHat))
                        {
                            //'Normal' Special Hats
                            if (CensoredHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new CensoredHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (BreadfishHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new BreadfishHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (AdsHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new AdsHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (AndIHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new AndIHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            //Special Ability Hats
                            if (NoHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new NoHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (DittoHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new DittoHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (BombHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new BombHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (ChickenHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new ChickenHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (PiesHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new PiesHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (FinnerHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new FinnerHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (DJHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new DJHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            //Developer Hats
                            if (DenHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new DenHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (MilkHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new MilkHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (UpsideHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new UpsideHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            //turbans
                            if (TurbanData.find(teamHat.sprite.texture.textureIndex) != null)
                            {
                                Turban turban = new Turban(teamHat.x, teamHat.y, teamHat.team);
                                ReplaceHat(teamHat, turban);
                                SpawnCape(turban, new Sprite(Mod.GetPath <EdoMod>("capes\\king")).texture);
                            }
                        }

                        /*if(!(teamHat is Turban))
                         * {
                         *  Turban turban = TurbanData.findHat(teamHat);
                         *  if (turban != null)
                         *  {
                         *      ReplaceHat(teamHat, turban);
                         *  }
                         *  if (teamHat is Turban)
                         *  {
                         *      SpawnCape(turban, new Sprite(Mod.GetPath<EdoMod>("capes\\king")).texture);
                         *  }
                         * }*/
                    }
                }
                List <Thing> removedHats = teamSpawnsDone.Keys.Except(Level.current.things[typeof(TeamHat)]).ToList();
                foreach (Thing thing in removedHats)
                {
                    TeamHat teamHat = thing as TeamHat;
                    if (teamHat != null && teamSpawnsDone.ContainsKey(teamHat))
                    {
                        Cape cape;
                        if (teamSpawnsDone.TryGetValue(teamHat, out cape))
                        {
                            Level.Remove(cape);
                        }
                        teamSpawnsDone.Remove(teamHat);
                    }
                }

                //DIVEKICK!
                //Duck.grounded

                IEnumerable <Thing> ducks = Level.current.things[typeof(Duck)];
                foreach (Duck duck in ducks)
                {
                    if (!duck.grounded && duck.sliding)
                    {
                        //Duck target = Level.current.NearestThing<Duck>(duck.position);
                        foreach (Duck target in ducks)
                        {
                            //can't target null or self
                            if (target == null || target == duck)
                            {
                                continue;
                            }
                            //can't kill a dead target
                            if (target.dead)
                            {
                                continue;
                            }
                            //near to duck && falling down
                            if ((target.position - duck.position).length < 10f && duck.velocity.y > 0)
                            {
                                //Performed DIIIVE KICK!
                                SFX.Play(EdoMod.GetPath <EdoMod>("SFX\\DiveKick"));
                                target.Kill(new DTImpact(duck));
                            }
                        }
                    }
                }
            }
        }