Beispiel #1
0
        /// <summary>
        ///     Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked             // Overflow is fine, just wrap
            {
                int hashCode = 41;
                // Suitable nullity checks etc, of course :)

                hashCode = hashCode * 59 + Cost.GetHashCode();
                if (Name != null)
                {
                    hashCode = hashCode * 59 + Name.GetHashCode();
                }

                hashCode = hashCode * 59 + Permanent.GetHashCode();
                if (Description != null)
                {
                    hashCode = hashCode * 59 + Description.GetHashCode();
                }

                hashCode = hashCode * 59 + Rounds.GetHashCode();
                if (Values != null)
                {
                    hashCode = hashCode * 59 + Values.GetHashCode();
                }

                hashCode = hashCode * 59 + Type.GetHashCode();

                hashCode = hashCode * 59 + Id.GetHashCode();
                return(hashCode);
            }
        }
Beispiel #2
0
    private void SetPosition(Permanent source)
    {
        Vector2 newPos = source.SourceCard.TransformManager.transform.position;

        newPos            += positionOffset;
        transform.position = newPos;
    }
 private void Awake()
 {
     card          = GetComponent <Card>();
     permanent     = GetComponent <Permanent>();
     dragHandler   = GetComponentInChildren <CardDragHandler>();
     iconsToResize = new List <Transform>(GetComponentsInChildren <Transform>()).FindAll(go => go.tag.Contains(TagsEnum.CardIcon));
 }
Beispiel #4
0
        public IActionResult DeletePermanent([FromRoute] int id)
        {
            Permanent permanent = _repository.PermanentAddress.FindByCondition(addr => addr.Id == id);

            if (permanent == null)
            {
                return(NotFound());
            }
            Other other = new Other
            {
                TenantId    = TenantId,
                AddressType = "Permanent Address",
                PersonId    = permanent.PersonId,
                Address     = permanent.Address,
                City        = permanent.City,
                State       = permanent.State,
                Country     = permanent.Country,
                Person      = permanent.Person,
                PhoneNumber = permanent.PhoneNumber,
                PinCode     = permanent.PinCode,
                IsActive    = false,
                CreatedDate = permanent.CreatedDate,
                UpdatedDate = DateTime.Now
            };

            _repository.OtherAddress.CreateAndSave(other);
            _repository.PermanentAddress.DeleteAndSave(permanent);
            _repository.PermanentAddress.Dispose();
            return(Ok(permanent));
        }
Beispiel #5
0
        public async Task <ActionResult <Permanent> > PostPermanent(Permanent permanent)
        {
            _context.Permanents.Add(permanent);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetPermanent), new { id = permanent.PermanentID }, permanent));
        }
Beispiel #6
0
        public async Task <IActionResult> PutPermanent(int id, Permanent permanent)
        {
            if (id != permanent.PermanentID)
            {
                return(BadRequest());
            }

            _context.Entry(permanent).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PermanentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (typeCase_ == TypeOneofCase.Time)
            {
                hash ^= Time.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Charges)
            {
                hash ^= Charges.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Profession)
            {
                hash ^= Profession.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Permanent)
            {
                hash ^= Permanent.GetHashCode();
            }
            if (typeCase_ == TypeOneofCase.Challenge)
            {
                hash ^= Challenge.GetHashCode();
            }
            hash ^= (int)typeCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Beispiel #8
0
        public void MergeFrom(BuffDuration other)
        {
            if (other == null)
            {
                return;
            }
            switch (other.TypeCase)
            {
            case TypeOneofCase.Time:
                if (Time == null)
                {
                    Time = new global::WUProtos.Data.Buff.TimeBuffDuration();
                }
                Time.MergeFrom(other.Time);
                break;

            case TypeOneofCase.Charges:
                if (Charges == null)
                {
                    Charges = new global::WUProtos.Data.ChargesBuffDuration();
                }
                Charges.MergeFrom(other.Charges);
                break;

            case TypeOneofCase.Profession:
                if (Profession == null)
                {
                    Profession = new global::WUProtos.Data.Profession.ProfessionBuffDuration();
                }
                Profession.MergeFrom(other.Profession);
                break;

            case TypeOneofCase.Permanent:
                if (Permanent == null)
                {
                    Permanent = new global::WUProtos.Data.Buff.PermanentBuffDuration();
                }
                Permanent.MergeFrom(other.Permanent);
                break;

            case TypeOneofCase.Instant:
                if (Instant == null)
                {
                    Instant = new global::WUProtos.Data.Buff.InstantBuffDuration();
                }
                Instant.MergeFrom(other.Instant);
                break;

            case TypeOneofCase.Challenge:
                if (Challenge == null)
                {
                    Challenge = new global::WUProtos.Data.Challenge.ChallengeBuffDuration();
                }
                Challenge.MergeFrom(other.Challenge);
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
Beispiel #9
0
 public void Show(Permanent source)
 {
     this.source = source;
     SetPosition(source);
     effectsButton.SetActive(source.ActivatedEffects.Count > 0);
     attackButton.SetActive(source is Creature);
     gameObject.SetActive(true);
 }
Beispiel #10
0
 public IActionResult PutPermanent([FromBody] Permanent permanent)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     _repository.PermanentAddress.UpdateAndSave(permanent);
     _repository.PermanentAddress.Dispose();
     return(Ok(permanent));
 }
Beispiel #11
0
        public IActionResult GetPermanent([FromRoute] int id)
        {
            Permanent Permanent = _repository.PermanentAddress.FindByCondition(addr => addr.PersonId == id);

            _repository.PermanentAddress.Dispose();
            if (Permanent == null)
            {
                return(NotFound());
            }
            return(Ok(Permanent));
        }
Beispiel #12
0
    private void OnEnable()
    {
        Permanent[] ps = FindObjectsOfType <Permanent>();
        Permanent   p  = FindObjectOfType <Permanent>();

        foreach (Permanent.DeathData d in p.deathPositions)
        {
            Debug.Log("IN");
            GameObject go = (GameObject)Instantiate(deadPrefab, d.position, d.rotation, null);
        }
    }
 public IActionResult EditPermanentAddress(int pid, string EmployeeCode, Permanent permanent)
 {
     permanent.PersonId    = pid;
     permanent.UpdatedDate = DateTime.Now.Date;
     permanent.IsActive    = true;
     if (ModelState.IsValid)
     {
         permanent.UpdatedBy = Convert.ToInt32(GetSession().PersonId);
         HttpResponseMessage response = _services.PermanentAddress.PostResponse(ApiUrl + "/api/PermanentAddress/AddPermanent/" + permanent.Id, permanent);
         ViewBag.Message     = response.Content.ReadAsStringAsync().Result;
         TempData["success"] = "Permanent Address updated successfully.";
     }
     return(RedirectToAction("Profile", "People", new { PersonId = EmployeeCode }));
 }
Beispiel #14
0
        /// <summary>
        ///     Returns true if Upgrade instances are equal
        /// </summary>
        /// <param name="other">Instance of Upgrade to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Upgrade other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Cost == other.Cost ||
                     Cost.Equals(other.Cost)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     Permanent == other.Permanent ||
                     Permanent.Equals(other.Permanent)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Rounds == other.Rounds ||
                     Rounds.Equals(other.Rounds)
                 ) &&
                 (
                     Values == other.Values ||
                     Values != null &&
                     other.Values != null &&
                     Values.SequenceEqual(other.Values)
                 ) &&
                 (
                     Type == other.Type ||
                     Type.Equals(other.Type)
                 ) &&
                 (
                     Id == other.Id ||
                     Id.Equals(other.Id)
                 ));
        }
    public void kill(Permanent permanent)
    {
        switch (permanent)
        {
        case Creature creature:
            kill(creature);
            break;

        case Structure structure:
            kill(structure);
            break;

        default:
            throw new Exception("Unexcepted permanent type");
        }
    }
Beispiel #16
0
 public void PyrofighterMagnusAbility_Resolve_PermanentIsInBattleZone_CardGoesToHand()
 {
     var player = new Player();
     var card = new Card { Owner = player.Id };
     var ability = new PyrofighterMagnusAbility { Controller = player.Id };
     card.Abilities.Add(ability);
     var duel = new Duel();
     duel.Players.Add(player);
     duel.Players.Add(new Player());
     player.BattleZone = new BattleZone();
     var permanent = new Permanent(card) { Controller = player.Id };
     player.BattleZone.Permanents.Add(permanent);
     ability.Source = permanent.Id;
     _ = ability.Resolve(duel, null);
     Assert.Empty(player.BattleZone.Permanents);
     Assert.Contains(card, player.Hand.Cards);
     //}
 }
Beispiel #17
0
        public List <Card> SearchCardsByToughness(int toughness)
        {
            List <Card> foundCards = new List <Card>();

            foreach (Card card in allcards)
            {
                if (card is Permanent)
                {
                    Permanent p = card as Permanent;
                    if (p.GetToughness() == toughness)
                    {
                        foundCards.Add(card);
                    }
                }
            }
            if (foundCards.Count > 0)
            {
                return(foundCards);
            }
            throw new NoSuchCardException("No such card(s) found");
        }
Beispiel #18
0
 public IActionResult PostPermanent([FromRoute] int id, [FromBody] Permanent permanent)
 {
     if (id == 0)
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         permanent.TenantId = TenantId;
         _repository.PermanentAddress.CreateAndSave(permanent);
         _repository.PermanentAddress.Dispose();
         return(CreatedAtAction("GetPermanent", new { id = permanent.Id }, permanent));
     }
     else
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         _repository.PermanentAddress.UpdateAndSave(permanent);
         _repository.PermanentAddress.Dispose();
         return(Ok(permanent));
     }
 }
Beispiel #19
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Permanent p = FindObjectOfType <Permanent>();
            if (p)
            {
                p.deathPositions.Clear();
            }
            SceneManager.LoadScene(0);
        }


        if ((active && contact > 0 && Input.GetButtonDown("Vertical") && Input.GetAxis("Vertical") > 0) ||
            Input.GetKeyDown(KeyCode.N))
        {
            Permanent p = FindObjectOfType <Permanent>();
            if (p)
            {
                p.deathPositions.Clear();
            }
            SceneManager.LoadScene(nextScene);
        }
    }
Beispiel #20
0
 public Permanent(Permanent p)
 {
 }
            public void Visit(PermanentAccessRule rule)
            {
                var dto = AccessRule.Permanent(rule.AccessPoint.AccessPointId);

                Permanent.Add(dto);
            }
Beispiel #22
0
 public void InitializeLayeredAttributeTests()
 {
     permanent = new Permanent();
 }