public override void IsAttacked(AttackObject atk, Vector3 colPosition) { if(atk.ValidateAttack(this)) { float value = 1.0f; LoseHP(value); } }
public override void Init(bool hasTimer, BattleObject host, AttackObject atk) { base.Init(hasTimer, host, atk); float totalDrain = (atk.P_attackValue - (host.P_totalDefense)) * atk.P_statusMultiplier; if (atk.P_statusTimer < Utils.eps){ H_owner.Heal (totalDrain); } }
public override void BeginAttackState(ref AttackObject currentAttack, float duration, float multiplier, float distance = 0.2F) { UpdateStats(); currentAttack.transform.parent = transform; currentAttack.RotateAroundParent(0F, 0F, 0F, H_objectDirection, distance); currentAttack.InitializeAttack (duration, multiplier, P_totalAttack); H_canDash = false; H_canAction = false; }
public override void Init(bool hasTimer, BattleObject host, AttackObject atk) { base.Init(hasTimer, host, atk); float totalDamage = (atk.P_attackValue - (host.P_totalDefense)) * host.P_poisonResistance * atk.P_statusMultiplier; if (atk.P_statusTimer < Utils.eps){ H_host.LoseHP(totalDamage); }else { _damageRate = totalDamage / atk.P_statusTimer; } }
public override void Init(bool hasTimer, BattleObject host, AttackObject atk) { base.Init(hasTimer, host, atk); float totalDrain = (atk.P_attackValue - (host.P_totalDefense)) * atk.P_statusMultiplier; if (atk.P_statusTimer < Utils.eps) { H_owner.Heal(totalDrain); } }
public override void OnHitTrigger(AttackObject attackObject, IHurtable entity) { base.OnHitTrigger(attackObject, entity); if (Random.Range(0, 100) > procChance) { return; } ((Player)owner).GainLife(attackObject.attack.GetDamage() * (lifeGainPercent / 100)); }
void SendAttack() { AttackObject attackCopy = GameObject.Instantiate(selectedAttack.attackObject, field.transform.position, field.transform.rotation); attackCopy.Setup(field, PlayerID, selectedAttack, cardToAttack); PopTextManager.CreateText(Vector3.zero + new Vector3(10f, 0f, 0f), string.Format("Player {0} used \n{1}\non Player {2}!", PlayerID, selectedAttack.attackName, cardToAttack.ownerID), Color.gray, 53, 120, 110, true); AudioSource.PlayClipAtPoint(attackCopy.attackSpawn, cam.transform.position); }
public virtual void Init(bool hasTimer, BattleObject host, AttackObject atk) { DontDestroyOnLoad(transform.gameObject); H_hasTimer = hasTimer; H_host = host; H_parentAttackValue = atk.P_attackValue; H_multiplier = atk.P_statusMultiplier; H_timer = atk.P_statusTimer; H_owner = atk.transform.parent.GetComponent<BattleObject>(); H_isInit = true; }
public virtual void Init(bool hasTimer, BattleObject host, AttackObject atk) { DontDestroyOnLoad(transform.gameObject); H_hasTimer = hasTimer; H_host = host; H_parentAttackValue = atk.P_attackValue; H_multiplier = atk.P_statusMultiplier; H_timer = atk.P_statusTimer; H_owner = atk.transform.parent.GetComponent <BattleObject>(); H_isInit = true; }
public override void OnHitTrigger(AttackObject attackObject, IHurtable entity) { base.OnHitTrigger(attackObject, entity); int random = Random.Range(0, 100); if (random <= procChance) { StatusEffect effect = ScriptableObject.Instantiate(statusEffect); effect.OnApplyEffect(owner); } }
//Read through the valid moves in heldattack to see if attack is valid bool ReadValidMoves(string attack) { foreach (AttackObject a in HeldAttack.valid_moves) { if (a.button == attack) { HeldAttack = a; return(true); } } return(false); }
void Update() { if (Input.GetKeyDown(KeyCode.Mouse0)) { if (Time.time >= m_timeOfNextAllowedAttack && !AttackObject.activeSelf) { m_timeOfNextAllowedAttack = Time.time + AttackCooldownTimeSeconds; AttackObject.SetActive(true); StartCoroutine("Attack"); } } }
//RIGHT CLICK, LEFT CLICK HELPER FUNCTIONS FOR PROCESS EVENT //Create the new atack object void CreateNewCombo(Vector2 mouse_position) { nodes = new List <ComboNode>(); connections = new List <Connection>(); AttackObject asset = CreateInstance <AttackObject>(); AssetDatabase.CreateAsset(asset, "Assets/Attack Objects/New Attack Object.asset"); AssetDatabase.SaveAssets(); nodes.Add(new ComboNode(mouse_position, NODE_WIDTH, NODE_HEIGHT, node_style, in_style, out_style, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, asset)); }
public void HandleAction(AttackObject @params) { GameObject hitbox = (GameObject)Instantiate(@params.hitbox, transform); Vector2 offset = @params.offset; if (checkFlip()) { offset = new Vector2(offset.x * -1, offset.y); } hitbox.transform.localPosition = offset; hitbox.layer = @params.layer; Destroy(hitbox.gameObject, @params.lifetime); }
// The damage formula is as follow : // (ATTACK VALUE - DEFENSE VALUE ) * ATTACK MULTIPLIER * RESISTANCE= DAMAGE DEALT // There is a lower limit of 10 * multiplier // and an upper limit of 1000 * multiplier before resistances. public virtual float CalculateDamage(AttackObject atk, float defenseValue) { float damageDealt = (float)(atk.P_attackValue - (H_defenseValue + P_defenseBonus + (int)(H_defenseValue * P_defenseBonusPercent))); if (damageDealt < 10F) { damageDealt = 10F; } else if (damageDealt > 1000) { damageDealt = 1000F; } return(damageDealt * atk.P_multiplier); }
internal AttackPatternNode([NotNull] MitreGraph graph, [NotNull] AttackObject attackPattern) : base(graph, "ATT&CK", attackPattern.AttackId) { if (attackPattern.Deprecated || attackPattern.Revoked) { throw new ArgumentException(Properties.Resources.InvalidStatus, "attackPattern"); } Name = attackPattern.Name; Description = attackPattern.Description; Likelihood = Evaluation.Unknown; Severity = Evaluation.Unknown; #region Add relationships. var capec = attackPattern.ExternalReferences? .Where(x => string.CompareOrdinal(x.Source, "capec") == 0) .ToArray(); if (capec?.Any() ?? false) { foreach (var c in capec) { AddRelationship(RelationshipType.PeerOf, "CAPEC", c.ExternalId.Substring(6)); } } #endregion #region Add the other properties. var platforms = attackPattern.Platforms?.ToArray(); if (platforms?.Any() ?? false) { Platforms = new List <string>(platforms); } var permissions = attackPattern.PermissionsRequired?.ToArray(); if (permissions?.Any() ?? false) { PermissionsRequired = new List <string>(permissions); } Detection = attackPattern.Detection; var kcfs = attackPattern.KillChainPhases? .Where(x => string.CompareOrdinal(x.Name, "mitre-attack") == 0) .Select(x => x.Phase) .ToArray(); if (kcfs?.Any() ?? false) { KillChainPhases = new List <string>(kcfs); } #endregion }
public override void Init(bool hasTimer, BattleObject host, AttackObject atk) { base.Init(hasTimer, host, atk); float totalDamage = (atk.P_attackValue - (host.P_totalDefense)) * host.P_poisonResistance * atk.P_statusMultiplier; if (atk.P_statusTimer < Utils.eps) { H_host.LoseHP(totalDamage); } else { _damageRate = totalDamage / atk.P_statusTimer; } }
void CollisionAttackOrResponse(AttackObject unit, RTSObject enemy, float dist) { if (unit.side != enemy.side) { if (dist <= unit.attack.attackRadius + enemy.SoftRadius) { unit.Attack(enemy); } } if (dist > unit.attack.attackRadius + enemy.SoftRadius && unit.attack.IsAttack && enemy == unit.attack.Enemy) { unit.EnemyOut(); } }
/// <summary> /// Tworzy samolot z wylosawnym po³o¿eniem (któryœ z krañców planszy). /// </summary> /// <param name="level"></param> public EnemyPlaneBase(Level level, Planes.PlaneType planeType) : base(level, true, planeType) { StartPositionInfo info = new StartPositionInfo(); //wylosowanie pozycji Random r = new Random(); int atEnd = r.Next(0, 2); //losuje 0 albo 1 float endPos = (level.LevelTiles.Count) * LevelTile.TileWidth - 2.0f * width; float x; if ((level.MissionType == MissionType.Dogfight || level.MissionType == MissionType.Survival) && level.EnemyPlanesLeft == level.EnemyFightersPoolCount) { // pierwszy samolot jest blizej lotniskowca x = atEnd * endPos * 0.6f + (1 - atEnd) * endPos * 0.4f; } else { x = atEnd * endPos + (1 - atEnd) * endPos * 0.05f; } x += r.Next(-6, 6); // HARD! //x = 1350; GameConsts.UserPlane.Singleton.GodMode=true; float y = r.Next(30, 40); info.Direction = atEnd == 0 ? Direction.Right : Direction.Left; info.EngineState = EngineState.Working; info.WheelsState = WheelsState.In; info.PositionType = StartPositionType.Airborne; info.Position = new PointD(x, y); info.Speed = GetConsts().Speed *0.01f * r.Next(90, 111); bounds = new Quadrangle(new PointD(x, y), width, height); this.startPositionInfo = info; Init(); attackObject = AttackObject.None; // StartEngine(); level.OnEnemyPlaneFromTheSide(!(atEnd == 1)); temp = new PointD(0, 0); InitIterpolateSet(); //Console.WriteLine("Enemy plane from the " + (atEnd==1?"right.":"left.")); }
void ThrowAttack(AttackObject bottle, float facing) { int throwRight; if (facing >= 0) { throwRight = 1; } else { throwRight = -1; } Rigidbody2D phys = bottle.GetComponent<Rigidbody2D>(); phys.AddForce(transform.right * horizontalPower * throwRight, ForceMode2D.Impulse); phys.AddForce(transform.up * verticalPower, ForceMode2D.Impulse); phys.AddTorque(-bottle.transform.right.x * rotationPower, ForceMode2D.Impulse); }
protected new void Start() { base.Start(); distFollow = 0.1f; moveTowards = true; emmitter = GetComponentInParent <MinionEmmitter>(); playerScript = player.GetComponent <Player>(); playerRB = player.GetComponent <Rigidbody2D>(); playerRenderer = player.GetComponent <Renderer>(); faca = GameManager.instance.gameObject.transform.Find("Faca").gameObject.GetComponent <AttackObject>(); bastao = GameManager.instance.gameObject.transform.Find("Bastao").gameObject.GetComponent <AttackObject>(); tampa = GameManager.instance.gameObject.transform.Find("Tampa").gameObject.GetComponent <ProtectionObject>(); escudo = GameManager.instance.gameObject.transform.Find("Escudo").gameObject.GetComponent <ProtectionObject>(); pedra = GameManager.instance.gameObject.transform.Find("Pedra").gameObject.GetComponent <FarAttackObject>(); papel = GameManager.instance.gameObject.transform.Find("Papel").gameObject.GetComponent <FarAttackMiniGameObject>(); }
public void Start() { World world = new World(30, 20); world.AssignChar(); world.DrawWorld(); AttackObject Sword = new AttackObject("Great Sword", new Position(1, 1), 15, 25, true); DefenceObject Shield = new DefenceObject("Thor", new Position(1, 1), 10, 20, true); Creature Knight = new Creature("Knight", 0, 100, new Position(6, 8), Shield, Sword); Knight.DealDamage(); Creature DarkKnight = new Creature("DarkKnight", 0, 100, new Position(5, 9), Shield, Sword); DarkKnight.ReceiveDamage(50); Knight.ReceiveDamage(100); }
/**************************************************/ /*ATTACK A UNIT*/ /*************************************************/ public void toggleAtk(int atkNumb) { if (!Equals(UnitHandler.unit1, null) && !UnitHandler.unit1.hasActed && UnitHandler.canSelect && !atkReady) { //Get the current attack currentAtk = UnitHandler.unit1.attacks[atkNumb]; //Create empty attack and populate it Debug.Log("Creating AttackObject!"); newAtk = Instantiate(Resources.Load("Attack/EmptyAttack") as GameObject); newAtk.SetActive(true); newAtk.name = "Effector"; //Link the attack to create the attack sphere newAtkScript = newAtk.GetComponent<AttackObject>(); newAtkScript.LinkedAttack = currentAtk; newAtkScript.init(); //Resize and show the attack circle range UnitHandler.unit1.atkCircle.transform.localScale = new Vector3(currentAtk.range, 0.2f, currentAtk.range); //Put it at last waypoint position UnitHandler.unit1.toggleAtkCircle(true); //Check if the attack is a blast attack if(UnitHandler.unit1.attacks[atkNumb] is AttackBlastCircle) { //Toggle the area circle for the blast attack atkReady = true; //targettingCircle.GetComponent<TargetCircle>().toggleTargetBlastCircle((AttackBlastCircle)currentAtk); } else { //List the targets if(listTargets()) atkReady = true; else { UnitHandler.unit1.toggleAtkCircle(false); newAtk.GetComponentInChildren<Effector>().deleteEffector(); } } } else Debug.Log("Unit has already acted"); }
protected override void Awake() { base.Awake(); oPos = Body.position; linkedVirgo = Body.Find("Virgo"); if (linkedVirgo != null) { posInVirgo = linkedVirgo.Find("PosInVirgo"); virgoAnimator = linkedVirgo.GetComponent <Animator>(); grabAttack = linkedVirgo.Find("Grab").GetComponent <AttackObject>(); grabAttack.Initialize(new HitInfos(EB, grabAttackStats)); } }
public ComboNode(Vector2 position, float width, float height, GUIStyle nodeStyle, GUIStyle in_style, GUIStyle out_style, Action <ConnectionPoint> OnClickInPoint, Action <ConnectionPoint> OnClickOutPoint, Action <ComboNode> OnclickdeRemoveNode, AttackObject attack) { rect = new Rect(position.x, position.y, width, height); style = nodeStyle; in_point = new ConnectionPoint(this, ConnectionPointType.In, in_style, OnClickInPoint); out_point = new ConnectionPoint(this, ConnectionPointType.Out, out_style, OnClickOutPoint); OnRemoveNode = OnclickdeRemoveNode; attack_object = attack; }
//public method public AttackObject GetAttackObject(AttackObjectList type) { Queue <InstantObject> container = null; GameObject prefab = null; switch (type) { case AttackObjectList.Bullet: container = _bullet; prefab = GameData.PrefabGunBullet; break; case AttackObjectList.Missile: container = _missile; prefab = GameData.PrefabMissile; break; case AttackObjectList.MissileBoss: container = _missileBoss; prefab = GameData.PrefabMissileBoss; break; case AttackObjectList.CapsuleAttack: container = _capsuleAttack; prefab = GameData.PrefabCapsuleAttackArea; break; case AttackObjectList.MonsterMeleeAttack: container = _monsterMeleeAttack; prefab = GameData.PrefabMonsterMeleeAttackArea; break; } if (container.Count == 0) { AddToContainer(prefab, container); } AttackObject rv = container.Dequeue() as AttackObject; rv.gameObject.SetActive(true); return(rv); }
//Function that goes through the timers and does actions void CheckTimers() { if (InputDelay > 0.0f) { InputDelay -= Time.deltaTime; } //Reset the combo, if dropped if (ComboDropTimer > 0.0f) { ComboDropTimer -= Time.deltaTime; } else { HeldAttack = null; } if (SpawnHitBoxTimer > 0.0f) { SpawnHitBoxTimer -= Time.deltaTime; } }
public bool TryDoAction() { if (ActionValidate() && apController.TrySpendAP(this)) { float hit = Random.Range(0f, 1f); if (hit < Attack.HitChange) { Target.Subtract(Attack.Damage); BroadcastMessage("OnAttackSuccess", new AttackMessage(Attack, Target)); Target.gameObject.BroadcastMessage("OnAttackHit", new AttackMessage(Attack, this)); } Target = null; Attack = null; return(false); } else { return(false); } }
private IEnumerator Shot() { IsAttack = true; IsChase = false; Ani.SetBool("isAttack", true); yield return(new WaitForSeconds(0.4f)); AttackObject missile = GameManager.Instance.Pooling.GetAttackObject(PoolManager.AttackObjectList.Missile); missile.transform.position = transform.position; missile.transform.rotation = transform.rotation; var attackInfo = new AttackInfo(this, Atk * MissileDamage, 0, "Player", transform.position, 1, (HitInfo info) => { GameManager.Instance.Effect.ExplosionEffect(info.HitPosition + Vector3.up * 2); }); missile.SetAttackInfo(attackInfo); missile.BulletFire(MissileSpeed, MissileRange); yield return(new WaitForSeconds(0.7f)); //공격 후딜레이 yield return(new WaitForSeconds(1f)); Ani.SetBool("isAttack", false); IsAttack = false; IsChase = true; }
public EvilCreature(int hitPoints, string name, AttackObject attackObject) { _hitPoints = hitPoints; _name = name; _attackObject = attackObject; }
public Creature(string name, int hitPoints, int maxHitPoints, Position creaturePosition, DefenceObject defenceObject, AttackObject attackObject) { _name = name; _hitPoints = hitPoints; _maxHitPoints = maxHitPoints; _creaturePosition = creaturePosition; _defenceObject = defenceObject; _attackObject = attackObject; Reset(); }
public void SetAttack(AttackObject a) { Attack = a; }
// The object has just been hit with an attack. public virtual void IsAttacked(AttackObject atk, Vector3 colPosition) { if(atk.ValidateAttack(this)) { bool blocked = false; if(H_ObjectState == ObjectState.Blocking) { //Compare Positions, to see if succesful guard Vector2 oppDir = atk.transform.parent.position - transform.position; if(Vector2.Angle(H_objectDirection,oppDir) < 46.0f) { blocked = true; Debug.Log("BLOCKED"); } } if(!blocked && H_invulnerability == false){ // This function calculates the damage dealt before applying resistances. float damageDealt = CalculateDamage(atk, H_defenseValue+P_defenseBonus+(int)(H_defenseValue*P_defenseBonusPercent)); switch (atk.P_attackType){ case AttackObject.AttackType.Normal : damageDealt *= H_normalResistance; GameObject.Instantiate(P_hitParticle,colPosition,Quaternion.identity); break; case AttackObject.AttackType.Fire : // A MODIFIER : créer une particule pour chaque type // d'attaque! damageDealt *= H_fireResistance; GameObject.Instantiate(P_hitParticle,colPosition,Quaternion.identity); break; case AttackObject.AttackType.Ice : // A MODIFIER : créer une particule pour chaque type // d'attaque! damageDealt *= H_iceResistance; GameObject.Instantiate(P_hitParticle,colPosition,Quaternion.identity); break; case AttackObject.AttackType.Lightning : // A MODIFIER : créer une particule pour chaque type // d'attaque! damageDealt *= H_lightningResistance; GameObject.Instantiate(P_hitParticle,colPosition,Quaternion.identity); break; case AttackObject.AttackType.Poison : // A MODIFIER : créer une particule pour chaque type // d'attaque! damageDealt *= H_poisonResistance; GameObject.Instantiate(P_hitParticle,colPosition,Quaternion.identity); break; } BattleInterface.Instance.ShowDamage(damageDealt, this); if(atk.P_statusEffect != null){ atk.P_statusEffect.Init(true, this, atk); } LoseHP(damageDealt); } } }
public void OnDrawGizmos() { Gizmos.color = Color.red; //Debug.Log("Enemy Hurtbox Center " + Entity.Body.mAABB.HalfSize); //Gizmos.DrawWireSphere(Entity.Body.mAABB.Center, Entity.Body.mAABB.HalfSize.x); if (Entity is Enemy) { Enemy E = (Enemy)Entity; //Debug.Log("Enemy Hurtbox Center " + E.HurtBox.mAABB.Center + " and Size: " + E.HurtBox.mAABB.HalfSize); Gizmos.DrawCube(E.HurtBox.mAABB.Center, E.HurtBox.mAABB.HalfSize * 2); } if (Entity is Player player) { //Debug.Log("Enemy Hurtbox Center " + E.HurtBox.mAABB.Center + " and Size: " + E.HurtBox.mAABB.HalfSize); Gizmos.DrawCube(player.HurtBox.mAABB.Center, player.HurtBox.mAABB.HalfSize * 2); if (player.AttackManager != null && player.AttackManager.meleeAttacks != null && player.AttackManager.meleeAttacks[0] != null && player.AttackManager.meleeAttacks[0].mIsActive) { Gizmos.color = Color.blue; } } if (Entity is AttackObject) { if (Entity is MeleeAttackObject) { MeleeAttackObject mAttack = (MeleeAttackObject)Entity; if (mAttack.hitbox.mState == ColliderState.Open) { Gizmos.color = Color.blue; AttackObject E = (AttackObject)Entity; //Debug.Log("Enemy Hurtbox Center " + E.HurtBox.mAABB.Center + " and Size: " + E.HurtBox.mAABB.HalfSize); Gizmos.DrawCube(E.hitbox.mAABB.Center, E.hitbox.mAABB.HalfSize * 2); } } else { Gizmos.color = Color.blue; AttackObject E = (AttackObject)Entity; //Debug.Log("Enemy Hurtbox Center " + E.HurtBox.mAABB.Center + " and Size: " + E.HurtBox.mAABB.HalfSize); Gizmos.DrawCube(E.hitbox.mAABB.Center, E.hitbox.mAABB.HalfSize * 2); } } if (Entity is ForceField forcefield) { if (forcefield.shieldBox.mState == ColliderState.Open) { Gizmos.color = Color.blue; Gizmos.DrawCube(forcefield.shieldBox.mAABB.Center, forcefield.shieldBox.mAABB.HalfSize * 2); } } Gizmos.color = Color.green; //Gizmos.DrawWireCube(Entity.Body.mAABB.Center, Entity.Body.mAABB.HalfSize*2); }
public virtual void OnHitTrigger(AttackObject attack, IHurtable entity) { }
public void Move(AttackObject attack, Transform attackObject, Action onComplete) { attack.StartCoroutine(Move(attackObject, onComplete)); }
private void RandomizeAttackStats(AttackObject attack) { attack.DamageModifier = RandomFunctions.GenerateGaussianShort(Agent.Rng, attack.DamageModifier, attack.DamageModifier / Agent.Probabilities.AttackStatStandardDivisor); }
public HitInfos(HitInfos knownInfos, AttackObject AttackObject) : this(knownInfos) { this.AttackObject = AttackObject; }
// The damage formula is as follow : // (ATTACK VALUE - DEFENSE VALUE ) * ATTACK MULTIPLIER * RESISTANCE= DAMAGE DEALT // There is a lower limit of 10 * multiplier // and an upper limit of 1000 * multiplier before resistances. public virtual float CalculateDamage(AttackObject atk, float defenseValue) { float damageDealt = (float)(atk.P_attackValue - (H_defenseValue+P_defenseBonus+(int)(H_defenseValue*P_defenseBonusPercent))); if (damageDealt < 10F) { damageDealt = 10F; } else if (damageDealt > 1000){ damageDealt = 1000F; } return damageDealt * atk.P_multiplier; }