public override void Execute(Entities.Entity Performer, List <Entities.Entity> Selection, CardGameState GS)
        {
            Unit AUnit = (Unit)Performer;
            Unit TUnit = (Unit)Selection[0];
            // Remove previous attach module if present
            List <Modules.Module> Check = AUnit.GetModules(ModuleType.Targetting, typeof(Modules.Target.Attached));

            if (Check.Count > 0)
            {
                Check[0].Message();
            }
            Modules.Module M1 = new Modules.Target.Attached(AUnit, TUnit);
            Modules.Module M3 = new Modules.NewTurn.Attached_NewTurn(TUnit, Performer.Name);

            AUnit.AddStatus("Attached this turn");
            AUnit.AddStatus("Attached:");
            AUnit.AddStatus("to " + TUnit.Name);

            TUnit.AddStatus("Attached:");
            TUnit.AddStatus("to " + AUnit.Name);

            AUnit.AddModule(M1.Type, M1);
            TUnit.AddModule(M3.Type, M3);
            TUnit.AddModule(ModuleType.Removed, new Modules.Removed.RemovedLink(TUnit, M1, M3));
        }
        public void Add(Entity entity)
        {
            using (SentimentAnalysisContext context = new SentimentAnalysisContext())
            {
                if (context.Entities.Any(e => e.Id == entity.Id))
                {
                    throw new EntityException("An Entity with the same ID already exists.");
                }

                Exists(entity);

                Entities.Entity toAdd = Helper.Instance.ToEntityEF(entity);
                context.Entities.Add(toAdd);
                context.SaveChanges();
                entity.Id = toAdd.Id;

                foreach (var phraseBD in context.Phrases.Where(p => p.Entity == null))
                {
                    PhraseRepository phraseRepository = new PhraseRepository();
                    var phrase = Helper.Instance.ToPhraseBL(phraseBD);

                    try
                    {
                        phrase.AnalyzePhrase(Helper.Instance.GetEntities(context.Entities), Helper.Instance.GetSentiments(context.Sentiments));
                    }
                    catch (AnalysisException) { }

                    phraseRepository.Modify(phrase.Id, phrase);
                }
            }
        }
Example #3
0
 public override void OnUse(Entities.Entity entity)
 {
     if (onUseEffect != null)
     {
         entity.StatsPackage.ApplyEffect(onUseEffect);
     }
 }
Example #4
0
 public AABBCollider(Entities.Entity entity, Map map, bool canMove, Entity[] IgnoreCollisWith) : base(entity, ComponentType.AABBCollider)
 {
     CanMove  = canMove;
     m_map    = map;
     Rect     = new Rectangle((int)m_entity.GetPos().X, (int)m_entity.GetPos().Y, (int)m_entity.GetDims().X, (int)m_entity.GetDims().Y);
     m_ignore = IgnoreCollisWith;
 }
Example #5
0
        public List <ActionOrder> GetPossibleActionOrders(CardGameState gameState, Entities.Entity performer)
        {
            List <ActionOrder> possibleActions = new List <ActionOrder>();

            if (Min == 0 || SelectType == PlayerType.NA)
            {
                possibleActions.Add(new ActionOrder(mAction, performer, null));
            }
            if (Max > 0)
            {
                List <List <Entities.Entity> > selections = null;
                if (SelectType == PlayerType.Ally)
                {
                    selections = GetPossibleSelections(performer.Owner.mBoard, performer, (uint)Min, (uint)Max);
                }
                if (SelectType == PlayerType.Enemy)
                {
                    selections = GetPossibleSelections(gameState.Players[(performer.Owner.getIndex() + 1) % 2].mBoard,
                                                       performer, (uint)Min, (uint)Max);
                }
                foreach (List <Entities.Entity> selection in selections)
                {
                    possibleActions.Add(new ActionOrder(mAction, performer, selection));
                }
            }
            return(possibleActions);
        }
Example #6
0
        //TODO Add new card types as implemented
        public static Entities.Entity ProduceCard(string cardName, CardPool CP)
        {
            CardData cardData = CP.GetCardData(cardName);

            Entities.Entity newEntity = null;

            switch (cardData.mType)
            {
            case CardType.BasicUnit:
                newEntity = new Entities.BasicUnit((UnitCardData)cardData);
                break;

            case CardType.Character:
                newEntity = new Entities.CharacterUnit((UnitCardData)cardData);
                break;

            case CardType.Effect:
                newEntity = new Entities.Effect_Entity((EffectCardData)cardData);
                break;

            default:
                UnityEngine.Debug.LogError("Tried to produce card of unknown type: " + cardData.mType.ToString());
                break;
            }

            return(newEntity);
        }
Example #7
0
 private void PerformBuffOnEntity(Entities.Entity entity)
 {
     Entities.Unit unit = (Unit)entity;
     if (mModules != null)
     {
         unit.AddModulesFromData(mModules);
     }
     if (mStatusTags != null)
     {
         foreach (StatusOperationPair pair in mStatusTags)
         {
             if (pair.mShouldAdd)
             {
                 if (!unit.HasStatus(pair.mTag))
                 {
                     unit.AddStatus(pair.mTag);
                 }
             }
             else
             {
                 unit.RemoveStatus(pair.mTag);
             }
         }
     }
     unit.TemporaryHP += mTempHPBuff;
 }
        public override void Execute(Entities.Entity Performer, List <Entities.Entity> Selection, CardGameState GS)
        {
            Entities.Unit attacker = (Entities.Unit)Performer;
            Entities.Unit target   = (Entities.Unit)Selection[0];

            attacker.DoAttack(target);
        }
Example #9
0
        /// <summary>
        /// Set the entity this animator works on.
        /// </summary>
        /// <param name="entity">Target entity to animate.</param>
        internal void SetTargetEntity(Entities.Entity entity)
        {
            // validate compatibility
            if (!CheckEntityCompatibility(entity))
            {
                throw new Exceptions.InvalidValueException("Entity type not compatible with this animator!");
            }

            // make sure not already attached
            if (TargetEntity != null && entity != null)
            {
                throw new Exceptions.InvalidStateException("Cannot attach animator to entity after it was already attached!");
            }

            // set entity
            if (entity == null)
            {
                OnDetach();
            }
            TargetEntity = entity;
            if (entity != null)
            {
                OnAttached();
            }
        }
Example #10
0
 public RemovedLink(Entities.Entity Parent, Module LinkedModule1, Module LinkedModule2, Module LinkedModule3)
 {
     this.Parent = (Entities.Unit)Parent;
     mLinkedModules.Add(LinkedModule1);
     mLinkedModules.Add(LinkedModule2);
     mLinkedModules.Add(LinkedModule3);
 }
Example #11
0
 public void Message(Entities.Entity Sender)
 {
     if (HasEffect)
     {
         TheEffect.Message(Sender);
     }
 }
Example #12
0
        // 'Depth' refers to the number of cards in the selection, but currentDepth starts from
        // 1 more than we already have selected eg. if our current depth is 2 and max depth is 3
        // then we already have selected one card and wish to find all the selections of 2 from the
        // remaining cards.
        private static List <List <Entities.Entity> > GetSelectionsFromDepth(
            List <List <Entities.Entity> > selections, PlayerBoard board, int totalCards,
            Entities.Entity performer, uint maxDepth, uint currentDepth, int startingCardIndex)
        {
            // Cache the selections containing cards added at this depth.
            List <List <Entities.Entity> > newSelections = new List <List <Entities.Entity> >();

            // Work out the range corresponding to the startingCardIndex
            int  currentRangeStartingIndex = 0;
            uint currentRangeIndex         = 0;

            for (uint j = 0; j < board.RangeZones.Length; j++)
            {
                if (startingCardIndex - (currentRangeStartingIndex + board.RangeZones[currentRangeIndex].List.Cards.Count) >= 0)
                {
                    currentRangeStartingIndex += board.RangeZones[currentRangeIndex].List.Cards.Count;
                    currentRangeIndex         += 1;
                }
                else
                {
                    break;
                }
            }

            // Add cards of this depth to selections.
            for (int i = startingCardIndex; i < totalCards; i++)
            {
                Entities.Entity currentCard = board.RangeZones[currentRangeIndex].List.Cards[i - currentRangeStartingIndex];
                if (currentCard != performer)
                {
                    if (maxDepth == currentDepth)
                    {
                        List <Entities.Entity> newSelection = new List <Entities.Entity>();
                        newSelection.Add(currentCard);
                        selections.Add(newSelection);
                        newSelections.Add(newSelection);
                    }
                    else
                    {
                        List <List <Entities.Entity> > returnSelections = GetSelectionsFromDepth(
                            selections, board, totalCards, performer, maxDepth, currentDepth + 1, i + 1);
                        foreach (List <Entities.Entity> list in returnSelections)
                        {
                            list.Add(currentCard);
                        }
                        newSelections.AddRange(returnSelections);
                    }
                }

                // Check if the next card is in the next range zone
                if (i + 1 - (currentRangeStartingIndex + board.RangeZones[currentRangeIndex].List.Cards.Count) >= 0)
                {
                    currentRangeStartingIndex += board.RangeZones[currentRangeIndex].List.Cards.Count;
                    currentRangeIndex         += 1;
                }
            }

            return(newSelections);
        }
Example #13
0
 protected override bool CheckValidityInternal(Entities.Entity Performer, List <Entities.Entity> Selection, TurnInfo TI)
 {
     if (TI.GetCPI() == Performer.GetOwnerIndex() && Performer.IsUnit() && !((Unit)Performer).HasStatus("Moved"))
     {
         return(true);
     }
     return(false);
 }
Example #14
0
 public Entities.Entity ConvertToObject(string path)
 {
     Entities.Entity result = null;
     System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(this.GetType());
     System.IO.StreamReader reader            = new System.IO.StreamReader(path);
     result = x.Deserialize(reader) as Entities.Entity;
     return(result);
 }
Example #15
0
 protected override void SetupInternal(Entities.Entity Parent, Loading.ModuleData MD)
 {
     this.Parent = (Unit)Parent;
     bool.TryParse(MD.Data[0], out mCanBypass.ShortOnShort);
     bool.TryParse(MD.Data[1], out mCanBypass.ShortOnLong);
     bool.TryParse(MD.Data[2], out mCanBypass.LongOnShort);
     bool.TryParse(MD.Data[3], out mCanBypass.LongOnLong);
 }
Example #16
0
 public override void Execute(Entities.Entity Performer, List <Entities.Entity> Selection, CardGameState GS)
 {
     if (((Unit)Performer).Owner.SpendCP(mMinCost))
     {
         ((Unit)Performer).RemoveStatus("Needs reloading");
         ((Unit)Performer).AddStatus("Reloading");
     }
 }
Example #17
0
 protected override bool CheckValidityInternal(Entities.Entity Performer, List <Entities.Entity> Selection, TurnInfo TI)
 {
     if (((Unit)Performer).HasStatus("Needs reloading") && ((Unit)Performer).Owner.CanSpendCP(mMinCost))
     {
         return(true);
     }
     return(false);
 }
Example #18
0
 public void Setup(Entities.Entity parent, Loading.ModuleData moduleData)
 {
     if (moduleData != null)
     {
         mConditions  = new Components.Conditional.ConditionChecker(moduleData.mConditionals);
         mMaxLifetime = moduleData.mLifetime;
     }
     SetupInternal(parent, moduleData);
 }
Example #19
0
 public ArmedEnemy(Entities.Entity entity, Map map, int health, float shootFrequency, float bulletSpeed) : base(entity, ComponentType.ArmedEnemy)
 {
     m_hitTimer       = 0;
     m_faceing        = Direction.Left;
     m_map            = map;
     m_health         = health;
     m_bulletSpeed    = bulletSpeed;
     m_shootFrequency = shootFrequency;
 }
Example #20
0
        public static CardObject Create <CardObject>
            (CardsUIManager UIM, Entities.Entity E, DisplayCard mainDisplayCard, ExpandingCard expandingCard)
            where CardObject : UICard, new()
        {
            CardObject newObject = new CardObject();

            newObject.Init(UIM, E, mainDisplayCard, expandingCard);
            return(newObject);
        }
Example #21
0
 protected virtual void Init(CardsUIManager UIM, Entities.Entity E, DisplayCard mainDisplayCard, ExpandingCard expandingCard)
 {
     mUIManager = UIM;
     mEntity    = E;
     UnityCard  = mainDisplayCard.UnityCard;
     UnityCard.GetComponentInChildren <Scripts.CardHolder>().OwningCard = this;
     mExpandingCard = expandingCard;
     mDisplayCard   = mainDisplayCard;
 }
Example #22
0
 public EntityViewModel(Entities.Entity entity)
 {
     Name        = entity.Name;
     Type        = ((EntityTypeEnum)entity.EntityTypeID).ToString();
     ID          = entity.EntityID;
     WalletID    = entity.WalletID;
     EquipmentID = entity.EquipmentID ?? -1;
     ImgURL      = entity.ImgUrl;
 }
        public override void Execute(Entities.Entity Performer, List <Entities.Entity> Selection, CardGameState GS)
        {
            Effects.Orders.OrderWithUses TheOrder = (Effects.Orders.OrderWithUses)(((Entities.Effect_Entity)Performer).GetEffect());

            int numSalvos = TheOrder.GetNumUses(mActionIndex);

            TheOrder.SetUses(mActionIndex, numSalvos - 1);
            ((Entities.Unit)Selection[0]).Damage(mDamage);
        }
Example #24
0
        public BusinessLogic.DTO.Entity ToEntityBL(Entities.Entity entity)
        {
            if (entity == null)
            {
                return(null);
            }

            return(new BusinessLogic.DTO.Entity(entity.Id, entity.Name));
        }
Example #25
0
        public static ExpandingObject Create <ExpandingObject>
            (Entities.Entity E, GameObject expandedCardPrefab)
            where ExpandingObject : ExpandingCard, new()
        {
            ExpandingObject newObject = new ExpandingObject();

            newObject.Init(E, expandedCardPrefab);
            return(newObject);
        }
Example #26
0
        //!---METHODS---!
        public Entities.Entity GetTarget(Vector2 _position)
        {
            target = null;

            //foreach (Entities.Entity entity in Rooms.RoomManager.CurrentRoom.Enemies)
            //    if (entity.CollisionBox.Intersects(new Rectangle((int)_position.X, (int)_position.Y, 1, 1)))
            //        target = entity;
            return target;
        }
Example #27
0
        public static DisplayObject Create <DisplayObject>
            (Entities.Entity E, GameObject displayCardPrefab)
            where DisplayObject : DisplayCard, new()
        {
            DisplayObject newObject = new DisplayObject();

            newObject.Init(E, displayCardPrefab);
            return(newObject);
        }
Example #28
0
 public override void OnCollide(Entities.Entity entity)
 {
     if (entity is Entities.Entity)
     {
         if (Keyboard.GetState().IsKeyDown(Keys.Space))
         {
             Open = true;
         }
     }
 }
 private PlayingCard FindCardForEntity(Entities.Entity E)
 {
     foreach (PlayingCard C in Cards)
     {
         if (C.GetEntity() == E)
         {
             return(C);
         }
     }
     return(null);
 }
Example #30
0
        public override void OnItemUsed(World world, Entities.Entity usedBy)
        {
            // Override default behavior to remove item from inventory
            var player = usedBy as PlayerEntity;

            if (player.GameMode != GameMode.Creative)
            {
                Damage(1);
                player.SetSlot(player.SelectedSlot, new ItemStack(Id, 1, Data));
            }
        }
Example #31
0
        public CountryMarketOffersListViewModel(Entities.Entity entity, Entities.Country currentCountry, IList <MarketOfferModel> offers, IList <Entities.Country> countries, IList <int> allowedProductTypes, PagingParam pagingParam, int quality, int productID)
        {
            Info = new CountryInfoViewModel(currentCountry);
            var marketService = DependencyResolver.Current.GetService <IMarketService>();

            foreach (var offer in offers)
            {
                Offers.Add(new MarketOfferViewModel(entity, offer, marketService));
            }

            initSelf(currentCountry, countries, allowedProductTypes, pagingParam, quality, productID);
        }
Example #32
0
 public Camera2D(Entities.Entity target)
 {
     _target = target;
     _center = target.BoundingRectCenter;
 }
Example #33
0
 public Camera2D(Entities.Entity target)
 {
     _target = target;
     _center = Vector2.Zero;
 }
Example #34
0
 public void SetTarget(Entities.Entity anchor)
 {
     _target = anchor;
 }