public void GetHit(BodyPart bp) { logger.Debug("Игрока " + Name + " бьют."); int ResPoints; if (bp != Blocked) { logger.Info("Блокирование не помогло от удара."); if (HP - 10 > 0) { if (bp == BodyPart.Head) { logger.Trace("Соперник бъет в голову."); if (HP - 15 > 0) { ResPoints = 15; HP -= ResPoints; Wound?.Invoke(this, new PlayerEventArgs(String.Format("Player {0} received minus {1} points, wounded {2}", Name, ResPoints, bp), Name, ResPoints, HP)); logger.Trace(Name + " получил минус 15 очков."); logger.Trace("Оставшееся здоровье: " + HP); } else { logger.Info(Name + " проиграл."); HP = 0; Death?.Invoke(this, new PlayerEventArgs($"Player {Name} is dead.", Name, HP, HP)); } } else { if (bp == BodyPart.Body) { logger.Trace("Соперник бъет в корпус."); } else { logger.Trace("Соперник бъет в ноги."); } ResPoints = 10; HP -= ResPoints; logger.Trace(Name + " получил минус 10 очков."); logger.Trace("Оставшееся здоровье: " + HP); Wound?.Invoke(this, new PlayerEventArgs(String.Format("Player {0} received minus {1} points, wounded {2}", Name, ResPoints, bp), Name, ResPoints, HP)); } } else { logger.Info(Name + " проиграл."); HP = 0; Death?.Invoke(this, new PlayerEventArgs($"Player {Name} is dead.", Name, HP, HP)); } } else { logger.Debug("Повезло! Блокирование спасло от удара."); logger.Trace("Оставшееся здоровье: " + HP); Block?.Invoke(this, new PlayerEventArgs($"Player {Name} was blocked succsessfully", Name, 0, HP)); } }
public int GetHit(BodyPart part, FightPapams par) { int damage; if (part != blockedPart) { damage = CalculateDamage(par.straight); hp -= damage; Wound.Invoke(this, part); } else { if (Dice.Throw() + (par.agility - agility) > 14) // chanse of succesfull block is 70% - agility difference { damage = CalculateDamage(par.straight); hp -= damage; Wound.Invoke(this, part); } else { damage = 0; Block.Invoke(this, blockedPart); } } return(damage); }
public override int DefenseProc(Character enemy, int damage) { if (!EnemySeen && enemy == Dungeon.Hero && ((Hero)enemy).subClass == HeroSubClass.ASSASSIN) { damage += pdsharp.utils.Random.Int(1, damage); Wound.Hit(this); } return(damage); }
public void InstantiateWound() { Wound wound = m_wounds[Random.Range(0, m_wounds.Length)]; Bounds bounds = m_woundBounds[Random.Range(0, m_woundBounds.Length)]; Vector3 pos = new Vector3(Random.Range(bounds.min.x, bounds.max.x), Random.Range(bounds.min.y, bounds.max.y)); Instantiate(wound, pos, Quaternion.identity); }
public override int CalcDamage(Wound wound, Model target, ShootingParams shootingParams) { if (wound.Mortal) { return(Dice.Sum(3, 1)); } return(base.CalcDamage(wound, target, shootingParams)); }
public override int CalcDamage(Wound wound, Model target, ShootingParams shootingParams) { if (target.Flyer) { //Two damage dices versus flyers return(CalcDamage(shootingParams, Damage * 2, DamageDice, DiceModes.Max)); } return(CalcDamage(shootingParams, Damage, DamageDice, DiceModes.Max)); }
public ComputerAIPresenter(IComputerAIWindow computerAIWindow, IFighter fighter) { ComputerAIWindow = computerAIWindow; Fighter = fighter; #region Подписка на события бойцa fighter.Block += (fighterName, hp) => Block?.Invoke(fighterName, hp); fighter.Wound += (fighterName, hp) => Wound?.Invoke(fighterName, hp); fighter.Death += (fighterName, hp) => Death?.Invoke(fighterName, hp); #endregion }
public static void Trigger(int pos, Character c) { if (c != null) { var damage = Math.Max(0, (Dungeon.Depth + 3) - Random.IntRange(0, c.Dr() / 2)); Buff.Affect <Bleeding>(c).Set(damage); Buff.Prolong <Cripple>(c, Cripple.Duration); Wound.Hit(c); } else { Wound.Hit(pos); } }
public void SpawnWound(Block location) { Vector3 spawnPoint = location.GetRandomPoint(); StartCoroutine(PingLocation(spawnPoint)); GameObject newWound = (GameObject)Instantiate(woundPrefab, spawnPoint, Quaternion.identity); Wound newWoundScript = newWound.GetComponent <Wound> (); newWoundScript.block = location; location.wounds.Add(newWound.GetComponent <Wound>()); dialogOpen = EventType.EVENT_TYPE_WOUND; if (!woundedWindowActivated) { gameControl.TogglePauseGame(); } }
public FighterPresenter(IFighterWindow fighterWindow, IFighter fighter) { FighterWindow = fighterWindow; Fighter = fighter; #region Подписка на события бойцa Fighter.Block += (fighterName, hp) => Block?.Invoke(fighterName, hp); Fighter.Wound += (fighterName, hp) => Wound?.Invoke(fighterName, hp); Fighter.Death += (fighterName, hp) => Death?.Invoke(fighterName, hp); #endregion #region Подписка на события страницы FighterWindow.Fight += (sender, e) => Fight?.Invoke(sender, e); FighterWindow.Reload += (sender, e) => Reload?.Invoke(sender, e); #endregion }
public BodyPart(string name, float size, BodyPartType type) { //Basic things this.name = name; this.size = size; this.type = type; //Items and armor this.heldItem = null; this.naturalAttack = null; this.naturalArmor = null; this.wornArmor = null; //Functions and wounds partFunctions = new HashSet <BodyPartFunction>(); mayHold = new HashSet <ItemSlot>(); wound = new Wound(); }
public void GetHit(BodyParts part) { if (part != Blocked) { hp -= power; Wound?.Invoke(this, new PlayerEventArgs(Name, hp, power)); if (hp <= 0) { hp = 0; Death?.Invoke(this, new PlayerEventArgs(Name, hp, 0)); } } else { Block?.Invoke(this, new PlayerEventArgs(Name, hp, 0)); } }
public void MaggotWound(Wound wound) { if (state != PatientState.alive) { return; } foreach (GameObject w in woundList) { if (wound.Equals(w)) { GameObject newWound = Instantiate(cleanWound, wound.transform.position, Quaternion.identity, this.transform); woundList.Add(newWound); woundList.Remove(w); Destroy(w); } } }
public void GetHit(BodyParts bodyParts) { if (bodyParts != Bloked) { if (HP > 0) { HP -= 10; Wound?.Invoke(this, new FightEventArgs(Name, HP)); } else { Death?.Invoke(this, new FightEventArgs(Name, HP)); } } else { Block?.Invoke(this, new FightEventArgs(Name, HP)); } }
virtual public void getHit(BodyParts attacked, BattleEventArgs e) { if (attacked == body) { Block?.Invoke(this, e); } else { Hp -= (int)attacked; e.hp = Hp; if (Hp > 0) { Wound?.Invoke(this, e); } else { Death?.Invoke(this, e); } } }
public void GetHit(PartOfTheBody hit) { if (Blocked == hit) { Block?.Invoke(FighterName, Hp); } else { Hp -= 20; if (Hp <= 0) { Death?.Invoke(FighterName, 0); } else { Wound?.Invoke(FighterName, Hp); } } }
public ActionResult AddWound(Wound model) { var response = ""; if (this.Session["UserID"] != null) { model.UserID = Convert.ToInt32(this.Session["UserID"]); Wound wound = this._managePatient.SavePatientWoundDetails(model); AddWoundImage(model.OriginalImage, "original", 1); AddWoundImage(model.SecondImage, "second", 1); AddWoundImage(model.EdgeDetectedImage, "edge", 1); } else { response = "-1"; } return(Json(response)); }
public void GetHit(BodyParts target) { if (target == TargetBlock) { Block?.Invoke(this, new FightEventArgs($"{Name} заблокировал удар.", Name, HP)); } else { HP -= Dice.Roll("3d6+5"); if (HP <= 0) { HP = 0; Death?.Invoke(this, new FightEventArgs($"Победил {Name}", Name, HP)); } else { Wound?.Invoke(this, new FightEventArgs($"{Name} получил ранение. У него осталось всего {HP} HP.", Name, HP)); } } }
public void GetHit(BodyPart attackedPart, int damage = 20) { if (attackedPart != Blocked) { if (damage < Hp) { Hp -= damage; Wound?.Invoke(this, new PlayerEventArgs(Name, Hp, "Received 20 damage")); } else { Hp = 0; Death?.Invoke(this, new PlayerEventArgs(Name, Hp, "Died")); } } else { Block?.Invoke(this, new PlayerEventArgs(Name, Hp, String.Format("Hit to {0} was blocked", attackedPart))); } }
public void TryBlock(BodyComponents attackedPart, CombatEventArgs e) { if (!GetHit(attackedPart)) { Block?.Invoke(this, e); } else { int damage = e.randomGenerator.Next(2, 20); e.currentHP = HP - damage; HP = e.currentHP; if (HP > 0) { Wound?.Invoke(this, e); } else { Death?.Invoke(this, e); } } }
public bool SavePatientWoundDetails(Wound details) { try { Wound obj = new Wound(); obj.UserID = details.UserID; obj.EdgeDetectedImage = details.EdgeDetectedImage; obj.OriginalImage = details.OriginalImage; obj.SecondImage = details.SecondImage; obj.SufferingFrom = details.SufferingFrom; obj.Threshold = details.Threshold; obj.WoundDetails = details.WoundDetails; //obj.Woundtype = 2; this.unitOfWork.WoundRepository.Insert(obj); this.unitOfWork.Save(); return(true); } catch (Exception e) { return(false); } }
public void OnWound(FightCourseEventArgs args) { Wound?.Invoke(this, args); }
private void OnWound() { Wound?.Invoke(this, new PlayerEventArgs(Name, Id, healthPoints)); }
// Update is called once per frame void Update() { if (gameControl.IsPaused()) { return; } /*if (Time.time - spawnTime > 120) { * gameControl.selected.Remove (this.gameObject); * gameControl.platelets.Remove (this); * currentBlock.platelets.Remove(this); * Destroy (this.gameObject); * return; * }*/ if (this.speed != gameControl.rbcSpeed) { this.speed = gameControl.rbcSpeed / 250.0f; } if (!currentBlock.notClotted) { speed = 0.00001f; } else { speed = gameControl.rbcSpeed / 250.0f; } if (currentBlock.wounds.Count > 0 && !attackingWound) { woundToAttack = (Wound)(currentBlock.wounds[0]); destination = woundToAttack.transform.position; attackingWound = true; } //If we are at current way point or the destination has been changed if (Vector2.Distance(destination, this.transform.position) < .03 || destChanged) { if (attackingWound) { if (woundToAttack != null) { woundToAttack.plateletsCount++; woundToAttack.plateletArrivalTime = Time.time; } gameControl.selected.Remove(this.gameObject); gameControl.platelets.Remove(this); currentBlock.platelets.Remove(this); Destroy(this.gameObject); return; } // Need to replace old destination with new one by setting nextBlock = currentBlock, // otherwise the cells will try to move to old block's exitPoint first if (destChanged) { nextBlock = currentBlock; destChanged = false; } //If we have arrived at our exit node, our next node should be the next cells entrance node //Dest change is to check if it was a destchange request or we reach current node //Otherwise if we are not in the correct block we need to find the next exit if (destBlock && destBlock != nextBlock) { foreach (ExitPoint exitPoint in nextBlock.GetExitPoints()) { if (ExitPointLeadsToDestination(exitPoint.gameObject, destBlock, nextBlock)) { destination = exitPoint.gameObject.transform.position; nextBlock = exitPoint.nextBlock; break; } } } //If we are in the correct block we need to go to users click else if (hasUserDest) { destination = (Vector3)userDest; hasUserDest = false; } //Last option is going to a random waypoint else { destination = nextBlock.GetRandomPoint(); } } Vector2 directionToDestination = ((Vector2)destination - (Vector2)this.transform.position).normalized; this.transform.position = new Vector3((directionToDestination.x * speed) + this.transform.position.x, (directionToDestination.y * speed) + this.transform.position.y, this.transform.position.z); }