public void enactEffects(Collider2D tgt) { PKMNEntity enemy = tgt.GetComponent <PKMNEntity>(); int damage = Battle.damageCalc(basis.level, PWR, basis.accessStat(BaseStat.ATTACK), basis.accessStat(BaseStat.DEFENSE)); enemy.StartCoroutine(enemy.receiveDamage(damage, basis)); enemy.StartCoroutine(grabKnockback(enemy.transform)); }
//Execute Method public IEnumerator execute() { offCD = false; bool alreadyFull = false; float channelTimer = 0f; float totalTimer = 0f; float soundTimer = 0f; basis.soundFXs.clip = Resources.Load <AudioClip>("Audio/AttackSounds/Dash"); //Establish sound clip anim.SetBool("Dashing", true); anim.SetFloat("speed", 0f); basis.getController().canMove = false; progress.gameObject.SetActive(true); //Channeling while (Input.GetMouseButton(1) && !basis.isStunned() && totalTimer < MAX_CHANNEL) { channelTimer = (channelTimer < FULL_CHANNEL) ? channelTimer + Time.deltaTime : FULL_CHANNEL; progress.updateProgress(channelTimer / FULL_CHANNEL); totalTimer += Time.deltaTime; soundTimer += Time.deltaTime; //Sound effects if (channelTimer >= FULL_CHANNEL && !alreadyFull) { basis.soundFXs.Stop(); basis.soundFXs.clip = Resources.Load <AudioClip>("Audio/AttackSounds/Beep"); basis.soundFXs.Play(); alreadyFull = true; } else if (soundTimer >= CHARGE_SOUND_INTERVAL && !alreadyFull) { soundTimer = 0.0f; basis.soundFXs.Stop(); basis.soundFXs.Play(); } basis.GetComponent <Rigidbody2D>().velocity = Vector2.zero; Battle.updatePlayerAOrientation(basis.transform); yield return(new WaitForFixedUpdate()); } progress.gameObject.SetActive(false); if (!basis.isStunned() && basis.isAlive()) //If the fighter isn't stunned, execute dash //Calculate stats { curPwr = getChannelStat(MIN_PWR, MAX_PWR, channelTimer); curDashStrength = getChannelStat(MIN_DASH_STRENGTH, MAX_DASH_STRENGTH, channelTimer); basis.soundFXs.Stop(); basis.soundFXs.clip = Resources.Load <AudioClip>("Audio/AttackSounds/Dash"); basis.soundFXs.Play(); yield return(basis.StartCoroutine(dashBox.executeDash(this, curDashStrength, DASH_DURATION, PRIORITY))); } }
//Method that updates timer. // Pre: Called within a looping function (PKMNEntity's Update) // Post: Updates timer IF there are any elements present in the queue and checks it with // the front most element public void update() { if (qStruct.Count > 0) { float delta = Time.deltaTime; timer += delta; //Update Timer //Poison method if (poisonIntensity > 0f) { pTimer += delta; if (pTimer > POISON_TICK) { pTimer = 0f; int damage = entity.accessBaseStat(BaseStat.HEALTH) / curPoisonDamage; entity.StartCoroutine(entity.receiveDoT(damage, null)); } } //If timer exceeds the current duration, remove and reverse the effect if (timer >= qStruct.First.Value.getDuration()) { StatEffect finishedSE = this.remove(); finishedSE.reverseEffect(this.entity); } } }
//Enact effects method public void enactEffects(Collider2D enemy) { PKMNEntity enemyFighter = enemy.GetComponent <PKMNEntity>(); //Bounds shotgunBounds = shotgunBlast.GetComponent<Collider2D>().bounds; int pwr; float offense; float defense; pwr = SHOTGUN_PWR; offense = basis.accessStat(BaseStat.SPECIAL_ATTACK); defense = enemyFighter.accessStat(BaseStat.SPECIAL_DEFENSE); int damage = Battle.damageCalc(basis.level, pwr, offense, defense); enemyFighter.StartCoroutine(enemyFighter.receiveDamage(damage, basis)); StatEffect effects = new StatEffect(STAT_DURATION, REDUCTION_FACTOR, BaseStat.SPECIAL_DEFENSE); effects.applyEffect(enemyFighter); //THIS SENSING METHOD DOES NOT WORK /*if(enemy.bounds.Intersects(shotgunBounds)) { * pwr = SHOTGUN_PWR; * offense = basis.accessStat(BaseStat.SPECIAL_ATTACK); * defense = enemyFighter.accessStat(BaseStat.SPECIAL_DEFENSE); * StatEffect effects = new StatEffect(STAT_DURATION, REDUCTION_FACTOR, BaseStat.SPECIAL_DEFENSE); * effects.applyEffect(enemyFighter); * }else{ * pwr = DASH_PWR; * offense = basis.accessStat(BaseStat.ATTACK); * defense = enemyFighter.accessStat(BaseStat.DEFENSE); * }*/ }
//Execute quick attack move public IEnumerator execute() { numCharges--; //If run out of charges, move is on cooldown if (numCharges <= 0) { offCD = false; cTimer = 0.0f; } basis.soundFXs.Stop(); basis.soundFXs.clip = Resources.Load <AudioClip>("Audio/AttackSounds/Dash"); basis.soundFXs.Play(); yield return(basis.StartCoroutine(dashBox.executeDash(this, DASH_STRENGTH, DASH_DURATION, PRIORITY))); }
//enableEffects method public void enactEffects(Collider2D enemy) { //Calculates damage PKMNEntity enemyFighter = enemy.GetComponent <PKMNEntity>(); int damage = Battle.damageCalc(basis.level, PWR, basis.accessStat(BaseStat.SPECIAL_ATTACK), enemyFighter.accessStat(BaseStat.SPECIAL_DEFENSE)); enemyFighter.StartCoroutine(enemyFighter.receiveDamage(damage, basis)); }
//Method that applies effect to enemies if hit public void enactEffects(Collider2D threat) { PKMNEntity enemy = threat.GetComponent <PKMNEntity>(); Vector2 kVect = Battle.dirKnockbackCalc(basis.transform.position, enemy.transform.position, KNOCKBACK_VAL); threat.GetComponent <Rigidbody2D>().AddForce(kVect); int damage = Battle.damageCalc(basis.level, PWR, basis.accessStat(BaseStat.ATTACK), basis.accessStat(BaseStat.DEFENSE)); enemy.StartCoroutine(enemy.receiveDamage(damage, basis)); }
//Upon collision on enemy, enact effects public void enactEffects(Collider2D enemy) { Vector2 knockbackVector = Battle.dirKnockbackCalc(basis.transform.position, enemy.transform.position, KNOCKBACK_VAL); enemy.GetComponent <Rigidbody2D>().AddForce(knockbackVector); //Calculates damage PKMNEntity enemyFighter = enemy.GetComponent <PKMNEntity>(); int damage = Battle.damageCalc(basis.level, PWR, basis.accessStat(BaseStat.ATTACK), enemyFighter.accessStat(BaseStat.DEFENSE)); enemyFighter.StartCoroutine(enemyFighter.receiveDamage(damage, basis)); }
//Applies effects to enemy hit public void enactEffects(Collider2D tgt) { PKMNEntity enemy = tgt.GetComponent <PKMNEntity>(); int damage = Battle.damageCalc(basis.level, INITIAL_PWR, basis.accessStat(BaseStat.SPECIAL_ATTACK), basis.accessStat(BaseStat.SPECIAL_DEFENSE)); enemy.StartCoroutine(enemy.receiveDamage(damage, basis)); //Add debuff StatEffect debuff = new StatEffect(DEBUFF_DURATION, DEBUFF_FACTOR, DEBUFF_TYPE); debuff.applyEffect(enemy.GetComponent <PKMNEntity>()); }
//Executes action for Pound (Player) // Creates a small box hitbox in front of user public IEnumerator execute() { Controller entityController = animator.GetComponent <PKMNEntity>().getController(); entityController.canMove = false; offCD = false; hitbox.GetComponent <Hitbox>().setMove(this, MOVE_PRIORITY); //Add melee sound effects basis.soundFXs.Stop(); basis.soundFXs.clip = Resources.Load <AudioClip>("Audio/AttackSounds/MeleeAttack"); basis.soundFXs.Play(); //Set position of hitbox centered at player Battle.updatePlayerAOrientation(animator.GetComponent <Transform>()); yield return(basis.StartCoroutine(updateHitBoxPos())); if (!basis.isStunned()) { entityController.canMove = true; } hit.Clear(); }
//Basic Execute method for player public IEnumerator execute() { numCharges--; //If charge is 0, activate big cooldown and reset timers if (numCharges <= 0) { offCD = false; cTimer = 0f; } Battle.updatePlayerAOrientation(anim.transform); //Shotgun sound effect basis.soundFXs.Stop(); basis.soundFXs.clip = Resources.Load <AudioClip>("Audio/AttackSounds/Shotgun"); basis.soundFXs.Play(); shotgunBlast = mainHitbox.GetComponent <ShotgunHitbox>().offensiveSetup(SHOTGUN_PRIORITY, this, SHOTGUN_KNOCKBACK); yield return(basis.StartCoroutine(dashBox.executeDashAwayMouse(this, DASH_STRENGTH, DASH_DURATION, DASH_PRIORITY))); canAttack = false; rTimer = 0f; }
//If someone enters, add them to data structure void OnTriggerEnter2D(Collider2D collider) { PKMNEntity enemy = collider.GetComponent <PKMNEntity>(); if (collider.tag == enemyTag || (collider.tag == enemyAttackTag && enemy != null)) { int damage = Battle.damageCalc(source.level, POISON_PWR, offenseStat, enemy.accessStat(BaseStat.SPECIAL_DEFENSE)); enemy.StartCoroutine(enemy.receiveDoT(damage, source)); hit.Add(enemy); if (enemyTag == "Player") { enemy.getController().SendMessage("setIsolation", true); } } }
//Sends damage if enemy is within hitbox of transform // Does damage to an area in front public void enactEffects(Collider2D enemy) { if (!hit.Contains(enemy)) { hit.Add(enemy); //Add enemy to hashset to avoid double dipping //Calculates knockback Vector2 knockback = Battle.sourceKnockbackCalc(animator, KNOCKBACK_VAL); //Calculates damage PKMNEntity enemyFighter = enemy.GetComponent <PKMNEntity>(); int damage = Battle.damageCalc(basis.level, PWR, basis.accessStat(BaseStat.ATTACK), enemyFighter.accessStat(BaseStat.DEFENSE)); enemy.GetComponent <Rigidbody2D>().AddForce(knockback); //Applies knockback enemyFighter.StartCoroutine(enemyFighter.receiveDamage(damage, basis)); } }
//Assist execute method for player public IEnumerator assistExecute() { yield return(basis.StartCoroutine(execute())); basis.getController().SendMessage("assistExecuted"); }
public IEnumerator enemyExecute(Transform tgt) { yield return(basis.StartCoroutine(execute())); }