Exemplo n.º 1
0
        public void PlaceSpellTrapFaceup(SpellTrap st)
        {
            var zIndex = SpellTrapZones.ToList().FindIndex(z => z.SpellTrapCard == null);

            SpellTrapZones[zIndex].SpellTrapCard = st;
            SpellTrapZones[zIndex].IsFaceup      = true;
            st.Location = CardLocation.SpellTrapZone;
            st.Position = CardPosition.FaceUp;
        }
Exemplo n.º 2
0
        public void MTarget(IPoint3D p)
        {
            if (!Caster.CanSee(p))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (SpellHelper.CheckTown(p, Caster) && CheckSequence())
            {
                int traps = 0;

                foreach (Item m in Caster.GetItemsInRange(10))
                {
                    if (m is SpellTrap)
                    {
                        ++traps;
                    }
                }

                if (traps > 2)
                {
                    Caster.SendMessage("There are too many magical traps in the area!");
                }
                else if (!Caster.Region.AllowHarmful(Caster, Caster))
                {
                    Caster.SendMessage("That doesn't feel like a good idea.");
                    return;
                }
                else
                {
                    SpellHelper.Turn(Caster, p);
                    SpellHelper.GetSurfaceTop(ref p);

                    Point3D loc = new Point3D(p.X, p.Y, p.Z);

                    int       TrapPower = (int)(Caster.Skills[SkillName.Magery].Value / 2);
                    SpellTrap mtrap     = new SpellTrap(Caster, TrapPower);
                    mtrap.Map      = Caster.Map;
                    mtrap.Location = loc;

                    Effects.SendLocationParticles(EffectItem.Create(loc, Caster.Map, EffectItem.DefaultDuration), 0x376A, 9, 10, Server.Items.CharacterDatabase.GetMySpellHue(Caster, 0), 0, 9502, 0);
                    Effects.PlaySound(loc, Caster.Map, 0x1EF);
                }
            }

            FinishSequence();
        }
Exemplo n.º 3
0
        public void RemoveSpellTrap(SpellTrap st)
        {
            var zIndex = SpellTrapZones.ToList().FindIndex(z => z.SpellTrapCard == st);

            SpellTrapZones[zIndex].SpellTrapCard = null;
        }
Exemplo n.º 4
0
        public static Card ToModel(this CardEntity entity)
        {
            Card card;
            var  types = entity.Types?.ToLower().Split(" / ");

            if (types is not null)
            {
                if (types.Contains("link"))
                {
                    card = new LinkMonster();
                }
                else if (types.Contains("xyz") && types.Contains("pendulum"))
                {
                    card = new XyzPendulum();
                }
                else if ((types.Contains("synchro") || types.Contains("fusion")) && types.Contains("pendulum"))
                {
                    card = new SynchroOrFusionPendulum();
                }
                else if (types.Contains("xyz"))
                {
                    card = new Xyz();
                }
                else if (types.Contains("pendulum"))
                {
                    card = new PendulumMonster();
                }
                else if (types.Contains("synchro") || types.Contains("fusion"))
                {
                    card = new SynchroOrFusion();
                }
                else
                {
                    card = new RegularMonster();
                }
            }
            else
            {
                card = new SpellTrap();
            }

            card.Name         = entity.Name;
            card.RealName     = entity.RealName;
            card.CardType     = Enum.TryParse <CardType>(entity.CardType, true, out var cardType) ? cardType : CardType.Unknown;
            card.Lore         = entity.Lore?.Replace(@"\n", "\n");
            card.Archetypes   = entity.Archetypes;
            card.Supports     = entity.Supports;
            card.AntiSupports = entity.AntiSupports;
            card.OcgExists    = entity.OcgExists;
            card.TcgExists    = entity.TcgExists;
            card.Img          = entity.Img;
            card.Url          = entity.Url;
            card.Passcode     = entity.Passcode?.TrimStart('0');

            if (card.OcgExists)
            {
                card.OcgStatus = GetCardStatus(entity.OcgStatus);
            }

            if (card.TcgExists)
            {
                card.TcgAdvStatus = GetCardStatus(entity.TcgAdvStatus);
                card.TcgTrnStatus = GetCardStatus(entity.TcgTrnStatus);
            }

            switch (card)
            {
            case Monster monster:
            {
                monster.Attribute = Enum.TryParse <MonsterAttribute>(entity.Attribute, true, out var attribute) ? attribute : MonsterAttribute.Unknown;
                monster.Types     = entity.Types.Split(" / ");

                if (monster is IHasAtk hasAtk)
                {
                    hasAtk.Atk = entity.Atk;
                }

                if (monster is IHasDef hasDef)
                {
                    hasDef.Def = entity.Def;
                }

                if (monster is IHasLevel hasLevel)
                {
                    hasLevel.Level = entity.Level;
                }

                if (monster is IHasLink hasLink)
                {
                    hasLink.Link       = entity.Link;
                    hasLink.LinkArrows = entity.LinkArrows.Split(',');
                }

                if (monster is IHasMaterials hasMaterials)
                {
                    hasMaterials.Materials = entity.Materials;
                }

                if (monster is IHasRank hasRank)
                {
                    hasRank.Rank = entity.Rank;
                }

                if (monster is IHasScale hasScale)
                {
                    hasScale.PendulumScale = entity.PendulumScale;
                }
                break;
            }

            case IHasProperty hasProperty:
                hasProperty.Property = entity.Property;
                break;
            }

            return(card);
        }