public Group(string name, int healthPoints, int damage, IAttack attack, IWarEffect warEffect) { this.Name = name; this.StartingHealthPoints = healthPoints; this.HealthPoints = healthPoints; this.Damage = damage; this.Attack = attack; this.WarEffect = warEffect; }
public Blob(string name, int health, int damage, IBehavior behaviorType, IAttack attackType) { this.Name = name; this.Health = health; this.Damage = damage; this.BehaviorType = behaviorType; this.AttackType = attackType; this.IsAlive = true; }
void Start () { Health = GetComponent<Health>(); // TODO(jordan): extract this into a MovesList class CurrentlySelectedAttack = GetComponent<BasicAttack>(); // !DEBUG(aaron) //Controller.CombatTimer.After(0.25f, () => Debug.Log("Hello from Unit!")); }
public static int CalculateDamage(Actor a, IAttack attack, Actor d) { int maxDamage = CalculateMaximumDamage(a, attack, d); int avgAccuracy = a.ActorType.AccuracyTrend.Calculate(a.Level) + a.Level; int totalAccuracy = a.Accuracy + attack.Accuracy; int accuracyDelta = totalAccuracy - avgAccuracy; double minDamagePercentage = CalculateMinimumDamagePercentage(accuracyDelta); int minDamage = (int)(maxDamage * minDamagePercentage); return Game.Random.Next(minDamage, maxDamage); }
public Blob(string name, int health, int damage, IBehavior behavior, IAttack attack) { this.Name = name; this.Health = health; this.Damage = damage; this.Behavior = behavior; this.Attack = Attack; this.InitialDamage = damage; this.InitialHealth = health; }
public Blob(string name, int health, int damage, IBehave behavior, IAttack attack) { this.Name = name; this.Health = health; this.Damage = damage; this.Behavior = behavior; this.Attack = attack; this.halfhealth = this.Health/2; }
public Blob(string name, int health, int damage, IAttack attack, string behaviorType) { this.Name = name; this.Health = health; this.initialHealth = Health; this.Damage = damage; this.attack = attack; this.behaviorType = behaviorType; this.dead = false; }
public Blob(int damage, int health, string name, IBehavior behavior, IAttack attackType) { this.Damage = damage; this.Health = health; this.Name = name; this.Behavior = behavior; this.AttackType = attackType; this.InitialDamage = damage; this.initialHealth = health; this.IsAlive = true; }
public Blob(string name, int health, int damage, IAttack attackType, IBehavior behaviorType) { this.Name = name; this.Health = health; this.InitialHealth = this.Health; this.Damage = damage; this.InitialDamage = this.Damage; this.AttackType = attackType; this.BehaviorType = behaviorType; this.HasUsedBehavior = false; }
public Blob(string name, int health, int damage, IAttack attack, IBehavior behavior) { this.Name = name; this.Health = health; this.Damage = damage; this.Attack = attack; this.Behavior = behavior; this.TurnsCounter = defaultTurnsCounter; this.defaultHealth = health; this.defaultDamage = damage; this.IsAlive = true; }
/// <summary> /// Initializes a new instance of the <see cref="Blob"/> class. /// </summary> /// <param name="name">The name of the blob.</param> /// <param name="health">The initial health value of the blob.</param> /// <param name="damage">The initial damage value of the blob.</param> /// <param name="attack">The Attack object of the blob.</param> /// <param name="behavior">The behavior object of the blob.</param> public Blob(string name, int health, int damage, IAttack attack, IBehavior behavior) : base(name) { this.initialHealth = health; this.initialDamage = damage; this.Health = this.initialHealth; this.Damage = this.initialDamage; this.attack = attack; this.behavior = behavior; this.attack.SetOwner(this); this.behavior.SetOwner(this); }
public Blob(string name, int health, int damage, IBehavior behavior, IAttack attack) { this.Name = name; this.Health = health; this.Damage = damage; this.Behavior = behavior; this.Attack = attack; this.BehaviorIsTriggered = false; this.BehaviorTriggeredInBattle = false; this.InitialBlobHealth = health; this.InitialBlobDamage = damage; }
public Blob( string name, int health, int attackDamage, IBehavior behavior, IAttack attack) : base(name) { this.Name = name; this.Health = health; this.AttackDamage = attackDamage; this.Behavior = behavior; this.AttackType = attack; }
public Blob(string name, int health, int damage, IBehavior blobBehavior, IAttack blobAttack) { Name = name; Health = health; InitialHealth = Health; Damage = damage; InitialDamage = Damage; BlobBehavior = blobBehavior; BlobAttack = blobAttack; IsAlive = true; BlobBehavior.HasBeenTriggered = false; }
public static int DynamicDamageCalculator(IAttack power) { int powerNumerator = new int(); for (int i = 0; i < HitPrecision; i++) { if (Randomizer.Rand.Next(0, 101) <= power.SuccessRate) { powerNumerator += power.AttackPower; } } if ((power.AttackType == AttackTypeEnum.ForceAttack && Rules == FightRulesEnum.MentalFight) || (power.AttackType == AttackTypeEnum.MindAttack && Rules == FightRulesEnum.BrutalFight)) { return powerNumerator / (HitPrecision * WrontHitPenaltyDenominator); } return powerNumerator / HitPrecision; }
public Blob(string name, int health, int damage, IAttackFactory attackFactory, IBehaviorFactory behaviorFactory, string attackType, string behaviorType) { this.Name = name; this.Health = health; this.Damage = damage; this.attackFactory = attackFactory; this.behaviorFactory = behaviorFactory; this.attack = this.attackFactory.DefineAttack(attackType); this.behavior = this.behaviorFactory.DefineBehavior(behaviorType); this.initialHealth = health; this.initialDamage = damage; this.hasTriggeredBehavior = false; this.concecutiveBehaviorDeley = DeffaultConcecutiveBehaviorDeley; }
public PlayerAttackComponent(SpriteSheetLoader spriteSheetLoader, SpriteBatch spriteBatch) { _spriteBatch = spriteBatch; _spriteLoader = spriteSheetLoader; _punchAttack = new PunchAttack(_spriteLoader, _spriteBatch); }
public IAttack ProduceAttack(IAttack initialAttack) { return(new DefaultAttack(initialAttack.TargetId, _damage)); }
// Start is called before the first frame update void Start() { attackController = GetComponentInChildren <IAttack>(); }
public void RemoveUnit(IAttack attack) { _attacks.Remove(attack); }
public void PerformAttack(IAttack attack, PokeBase victim) { victim.TakeDamage(attack); }
public Enemy(IAttack attackBehaviour, ICostLives costLivesBehaviour, IReward rewardBehaviour) { this.attackBehaviour = attackBehaviour; this.costLivesBehaviour = costLivesBehaviour; this.rewardBehaviour = rewardBehaviour; }
public IBlob Create(string name, int damage, int health, IBehavior behavior, IAttack attackType) { var blob = new Blob(damage, health, name, behavior, attackType); return blob; }
public FireAttack(IAttack attack) : base(attack) { ignoreTags = new List <string> { "Water" }; }
public IceAttack(IAttack attack) : base(attack) { ignoreTags = new List <string> { "Algo" }; }
private void InitiateAttack() { playerAttack = new PlayerAttack(inputReader, weaponSystem); playerAttack.InitiateAttack(); }
public void SetSecondaryAttack(IAttack attack) { this.secondaryAttack = attack; }
public void SetPrimaryAttack(IAttack attack) { this.primaryAttack = attack; }
public void TakeHit(IAttack hitBy) { var direction = Vector3.Normalize(transform.position - hitBy.transform.position); rigidbody.AddForce(direction * forceAmount, ForceMode.Impulse); }
private void HandleInput() { if (!disableInput) { IPlayerState newState = state.HandleInput(this); if (newState != null) { state.ExitState(this); state = newState; state.EnterState(this); } IAttack newAttackState = attackState.HandleInput(this); if (newAttackState != null) { attackState.ExitState(this); attackState = newAttackState; attackState.EnterState(this); } } }
public IBlob CreateBlob(string name, int health, int damage, IBehaviour behaviour, IAttack attack) { IBlob blob = new Blob(name, health, damage, behaviour, attack); return(blob); }
//ap = 25; //time = 5; //armor = 10; public override void defend(IAttack attack) { attack.setResultingPower(System.Math.Max(attack.getAttackPower() - this.getDefencePower(), 0)); }
public void SetAttack(int attackID, RuntimeAnimatorController attackAnimController) { currentFireArmAttack = FireArmAttacks[attackID]; topBodyAnimator.runtimeAnimatorController = attackAnimController; }
public void TakeDamage(IAttack attack) { this.Health -= attack.BaseDamage; }
public void SetDefaultAttack() { currentFireArmAttack = FireArmAttacks[1]; topBodyAnimator.runtimeAnimatorController = gunAnimController; EventManager.TriggerEvent(GlobalEvents.GunUsed, bulletCount); }
// TODO: Is it worth to use reflection on this one? private void Initialize() { switch (data.attackTarget) { case AttackTarget.Closest: iAttackTarget = new ClosestAttackTarget(this); break; default: iAttackTarget = new NoneAttackTarget(); break; } switch (data.onHitEffect) { case OnHitEffect.Slow: iOnHitEffect = new SlowAbility(); break; case OnHitEffect.Stun: iOnHitEffect = new StunAbility(); break; default: iOnHitEffect = new NoneAbility(); break; } switch (data.attackType) { case AttackType.SingleTarget: iAttack = new SingleTargetAttack(this, iOnHitEffect); break; case AttackType.AOE: iAttack = new AOEAttack(this, iOnHitEffect); break; } switch (data.buffTarget) { case BuffTarget.Aura: iBuffTarget = new AuraBuffTarget(this); break; default: iBuffTarget = new NoneBuffTarget(); break; } switch (data.buffType) { case BuffType.AttackDamage: iBuff = new AttackDamageBuff(this); break; case BuffType.AttackSpeed: iBuff = new AttackSpeedBuff(this); break; } }
/// <summary> /// Creates a new attack action, capturing the attack and target of the attack. /// </summary> public AttackAction(IAttack attack, Character target) { _attack = attack; _target = target; }
public static int CalculateMaximumDamage(Actor a, IAttack attack, Actor d) { int totalAttack = a.Attack + attack.Attack; int totalDefence = d.Defence; return Math.Abs(totalAttack - totalDefence); }
public void Attack(Character attacker, IAttack attack, Character defender) { if (attacker.Name.Equals(defender.Name)) { return; } string tempString; bool IsCritical = false; if (Global.random.Next(100) >= 100 - attack.CriticalHitProbability) { IsCritical = true; } if (defender.currentHealthState == HealthState.Normal) { if (Global.random.Next(100) >= 100 - attack.BurnProbability) { defender.currentHealthState = HealthState.Burn; defender.isBurnShaderOn = true; } if (Global.random.Next(100) >= 100 - attack.FreezeProbability) { defender.currentHealthState = HealthState.Freeze; defender.isFreezeShaderOn = true; } } //(1-attacker.damage) int Damage = CalculateDamage(attacker, attack, IsCritical, defender); defender.CurrentHealth -= Damage; defender.isHitShaderOn = true; if (defender.CurrentHealth > 0) { tempString = attacker.Name + " hit " + defender.Name + " with " + attack.Name + " for " + Damage; } else { tempString = attacker.Name + " killed " + defender.Name + " with " + attack.Name; attacker.Experience = attacker.Experience + defender.Experience; if (defender is Player) { Global.CurrentGameState = Global.Gamestates.isGameOver; } } if (IsCritical) { tempString += ". Critical hit!"; } if (defender.currentHealthState == HealthState.Freeze) { tempString += ". Frozen!"; } if (defender.currentHealthState == HealthState.Burn) { tempString += ". Burned!"; } Global.Gui.WriteToConsole(tempString); if (attacker is Warrior) { Warrior war = (Warrior)attacker; if (war.isBerserkerRageOn) { int heal = (int)Math.Ceiling(war.Health * 0.01); war.addHealth(heal); Global.Gui.WriteToConsole("Berserker Rage healed " + war.Name + " for " + heal); } } if (defender is Player) { Global.SoundManager.playerHurt.Play(); } }
public AttackDecorator(IAttack attack) { _attack = attack; }
public override IAttack ProduceAttack(IAttack initialAttack) { // TODO return(new DefaultAttack(initialAttack.TargetId, initialAttack.Damage * _attackMultiplier)); }
public void defend(IAttack attack) { this.getPlayerData().defend(attack); }
public virtual IAttack HandleAttack(IAttack initialAttack) { return(initialAttack); }
public IBlob CreateBlob(string name, int health, int damage, IBehavior behavior, IAttack attack) { Blob blob = new Blob(name,health,damage,behavior,attack); return blob; }
public AttackTest() { _attack = new Attack(); }
void Start() { state = new StandingState(); attackState = new IdleAttackState(); animator = GetComponent<Animator>(); AttackCollider.SetActive(false); health = GetComponent<Health>(); controller = GetComponent<MoveController>(); gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2) / 3; jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; print("Gravity: " + gravity + " Jump Velocity: " + jumpVelocity); initialRegenTime = 6; regenTick = 2; knockBackResistance = 10; knockBackCounter = 0; knockBackReset = 0; flinchResistance = 10; flinchCounter = 0; flinchReset = 0; text = GameObject.Find("HealthText").GetComponent<Text>(); text.text = text.GetComponent<Score>().modX(0).ToString(); blink = false; blinkTime = 0; }
public void AttackEnemy(IBlob enemyBlob, IAttack attackType) { this.Health = attackType.ChangeHealth(this.Health); CheckBehaviorDuringAttack(); enemyBlob.Health -= attackType.ChangeDamage(this.Damage); }
/* void Awake() { if (player == null) { player = gameObject; }else if(player != gameObject) { Destroy(gameObject); } }*/ void Start() { state = new StandingState(); attackState = new IdleAttackState(); animator = GetComponent<Animator>(); skillManager = gameObject.AddComponent<SkillManager>(); AttackCollider.SetActive(false); health = GetComponent<Health>(); controller = GetComponent<MoveController>(); crowdControllable = GetComponent<CrowdControllable>(); mana = GetComponent<Mana>(); attack = GetComponentInChildren<DealDamage>(); defense = GetComponent<Defense>(); attackController = GetComponent<AttackController>(); gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2); jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; audiosource = GetComponent<AudioSource>(); initialRegenTime = 6; regenTick = 2; DontDestroyOnLoad(gameObject); skill[0] = null; skill[1] = null; skill[2] = null; skill[3] = null; threatLevel = damageDealt = 0; GetComponent<ID>().setTime(false); CCI = GameObject.Find("Main Process").GetComponentInChildren<Character_Class_Info>(); si = GameObject.Find("Main Process").GetComponentInChildren<Skill_info>(); Fully_Update(); }
public int PerformAttack(IAttack attack) { this.Attack = attack; return(this.Attack.PerformAttack()); }
public void AssignSpell(IAttack spell) { spellAttack = spell; spellName = spell.GetType().ToString(); }
public Robot(IMove move, IAttack attack, string name) { this.MoveAlgorithem = move; this.AttackAlgorithem = attack; this.Name = name; }
public IBlob Create(string name, int health, int damage, IBehave behavior, IAttack attack) { return new Blob(name,health,damage,behavior,attack); }
// Start is called before the first frame update protected void Start() { if (cam == null) { cam = GetComponentInChildren <Camera>(); } int i = 0; foreach (var weapon in weapons) //go throught all weapons in list at start { if (weapon == null) //only is its not null { //if (primaryWeaponIndex < 0) // primaryWeaponIndex = i; //else if (secondaryWeaponIndex < 0) // secondaryWeaponIndex = i; i++; continue; } if (primaryWeaponIndex < 0 && weapon.type == WeaponType.primary) //if first primary, update primaryIndex { primaryWeaponIndex = i; } if (weapon.type == WeaponType.secondary) // if secondary { if (secondaryWeaponIndex < 0) //is not assigned yet { secondaryWeaponIndex = i; //set it } else //else drop other secondaries, because there can only be one. { //if (primaryWeaponIndex < 0) // primaryWeaponIndex = i; DropWeapon(i); i++; continue; } } weapon.Init(cam); //must init weapons weapon.Pick(); //weapon is already picked at start Dequip(weapon); //dequip temporarily if (weapon is MeleeBehaviour) //meh { melee = weapon.GetComponent <IAttack>(); } i++; //next. } currentEquippedWeaponIndex = -1; //equip something at start. if (primaryWeaponIndex >= 0) { EquipWeapon(primaryWeaponIndex); } else if (secondaryWeaponIndex >= 0) { EquipWeapon(secondaryWeaponIndex); } }
public virtual IAttack ProduceAttack(IAttack initialAttack) { return(initialAttack); }
public void AddGridSquare(IAttack gridSquare) { grid[((GridSquare)gridSquare).Y, ((GridSquare)gridSquare).X] = gridSquare; }