/** * Unlock a spell * * @param spell The spell to unlock */ public void Unlock(Spells.Spell spell) { if (OnUpdate != null) { OnUpdate(); } }
/// <summary> /// Crée une nouvelle instance de EntityTower. /// </summary> public EntityTower() : base() { LoadEntityConstants(GameServer.GetScene().Constants.Towers); TowerRange = GameServer.GetScene().Constants.Towers.VisionRange; Type |= EntityType.Tower; m_attackSpell = new Spells.FireballSpell(this); }
void OnTriggerEnter(Collider collision) { if (collision.gameObject.tag == "FootHead") { Objects.Player playerObj = collision.gameObject.GetComponentInParent <Objects.Player>(); playerObj.ResetJumps(); this.Damage(1); } else if (collision.gameObject.tag == "Sides") { Classes.Player player = collision.gameObject.GetComponentInParent <Classes.Player>(); player.Damage(1); // Give the player 1 second of invincibility after being damaged. Spells.Spell sp = player.GetSpell("NP_Invulnerability"); if (sp == null) { Debug.Log("Unable to get Invulnerability spell"); } Spells.Invulnerability inv = (Spells.Invulnerability)sp; inv.SetDuration(1); player.ReceiveBuff(inv); inv.Cast(); } else if (collision.gameObject.tag == "Projectile") { this.Damage(1); } }
/// <summary> /// Check if the player can cast a spell to the targeted cell /// </summary> /// <param name="spell">Casted spell</param> /// <param name="cell">Targeted cell</param> /// <param name="NoRangeCheck">if true, then skip all checking related with caster position, /// (preparatory stuff, before fight)</param> /// <returns>False if cannot cast the spell</returns> public bool CanCastSpell(Spells.Spell spell, Cell cell, bool NoRangeCheck = false) { // todo spells modifications // todo states if (cell == null) { NoRangeCheck = true; } if (!NoRangeCheck && !IsPlaying()) { return(false); } if (spell.LevelTemplate.apCost > Stats.CurrentAP) { return(false); } if (!NoRangeCheck && !IsInSpellRange(cell, spell.LevelTemplate)) { return(false); } // test the LoS if (!NoRangeCheck && spell.LevelTemplate.castTestLos && !Fight.CanBeSeen(Cell, cell, false)) { return(false); } return(true); }
void Update() { if (!checkLists(playerSpells, spellsScript.playerSpells)) { int j = 0; foreach (Transform child in transform.parent.transform) { if (child != this.transform && child.name != "MouseBar") { if (playerSpells.Count <= j || playerSpells[j] != spellsScript.playerSpells[j]) { GameObject.Destroy(child.gameObject); } j++; } } for (int i = 0; i < spellsScript.playerSpells.Count; i++) { if (playerSpells.Count <= i || playerSpells[i] != spellsScript.playerSpells[i]) { Spells.Spell spell = spellsScript.spellDict[spellsScript.playerSpells[i]]; Vector3 position = new Vector3(60 * i, -1, 0) - new Vector3(120, 0, 0); GameObject obj = Instantiate(spell.icon); obj.transform.SetParent(this.transform); obj.transform.localPosition = position; obj.transform.SetParent(this.transform.parent); } } this.transform.SetSiblingIndex(10); playerSpells = new List <Spells.SpellsEnum>(spellsScript.playerSpells); } }
public bool IsImmune(Spells.Spell spell) { if (spell.Categories == Spells.Spell.SpellCategory.Healing && HasState(76)) { return(true); } return(GetSpellImmunityEffects().Any(effect => effect.immuneSpellId == spell.Template.id)); }
//the projectile recieves parameters from the attacker public void RecieveParameters(string attacker, float damage, bool isCleave, int meter, float aggro, Spells.Spell buff) { _attacker = attacker; _damage = damage; _isCleave = isCleave; _meter = meter; _aggro = aggro; _buff = buff; }
/// <summary> /// Crée une nouvelle instance de EntityTower. /// </summary> public EntityVirus() : base() { LoadEntityConstants(GameServer.GetScene().Constants.Virus); AttackRange = GameServer.GetScene().Constants.Virus.AttackRange; HP = BaseMaxHP; m_currentCheckpointId = -1; m_attackSpell = new Spells.FireballSpell(this); Type |= EntityType.Virus; }
/// <summary> /// The projectile recieves parameters from the attacker /// </summary> /// <param name="attacker"></param> /// <param name="damage"></param> /// <param name="meter"></param> /// <param name="aggro"></param> /// <param name="size"></param> /// <param name="buff"></param> public void RecieveParameters(string attacker, float damage, int meter, float aggro, float size, Spells.Spell buff) { _attacker = attacker; _damage = damage; _meter = meter; _aggro = aggro; _size = size; _buff = buff; SetSize(); }
/// <summary> /// Crée une nouvelle instance de EntityDatacenter /// </summary> public EntityDatacenter() : base() { LoadEntityConstants(GameServer.GetScene().Constants.DatacenterConstants); HP = BaseMaxHP; VisionRange = 6.0f; AttackRange = VisionRange; Type |= EntityType.Datacenter; m_attackSpell = new Spells.FireballSpell(this); }
/// <summary> /// Try to cast a spell to a targeted cell /// </summary> /// <param name="spell">Spell to cast</param> /// <param name="cell">Targeted cell</param> /// <returns>False if cannot cast the spell</returns> public bool CastSpell(Spells.Spell spell, Cell cell) { if (!CanCastSpell(spell, cell)) { return(false); } Character.Bot.SendToServer(new GameActionFightCastRequestMessage((short)spell.Template.id, cell.Id)); return(true); }
/// <summary> /// Crée une nouvelle instance de EntityBigBoss. /// </summary> public EntityMiningFarm() : base() { BaseArmor = 80; BaseAttackDamage = 900; BaseMagicResist = 40; BaseMaxHP = 400; HP = BaseMaxHP; VisionRange = 6.0f; AttackRange = VisionRange; Type |= EntityType.MiningFarm; m_attackSpell = new Spells.FireballSpell(this); }
//the projectile recieves parameters from the attacker public void RecieveParameters(string attacker, int speed, float damage, float duration, int meter, float aggro, bool explodes, float size, GameObject prefab, Spells.Spell buff) { _attacker = attacker; _speed = speed; _damage = damage; _duration = duration; _meter = meter; _aggro = aggro; _explodes = explodes; _size = size; _prefab = prefab; _buff = buff; }
/// <summary> /// Crée une nouvelle instance de EntityCampMonster. /// </summary> public EntityCampMonster(Vector2 guardPosition) : base() { LoadEntityConstants(GameServer.GetScene().Constants.CampMonsters); AttackRange = GameServer.GetScene().Constants.CampMonsters.AttackRange; MaxMoveDistance = GameServer.GetScene().Constants.CampMonsters.MaxMoveDistance; Type = EntityType.Monster; HP = BaseMaxHP; GuardPosition = guardPosition; Position = GuardPosition; m_attackSpell = new Spells.FireballSpell(this, 1.7f, AttackRange + 1, EntityTypeRelative.Player); Type |= EntityType.Monster; }
/// <summary> /// Crée une nouvelle instance de EntityRouter. /// </summary> public EntityRouter(Vector2 guardPosition) : base() { Type = EntityType.Router; LoadEntityConstants(GameServer.GetScene().Constants.Routers); MaxMoveDistance = GameServer.GetScene().Constants.Routers.MaxMoveDistance; AttackRange = GameServer.GetScene().Constants.Routers.AttackRange; BaseAttackDamage = 60; BaseMagicResist = 40; BaseMaxHP = 100; HP = BaseMaxHP; BaseMoveSpeed = 2f; GuardPosition = guardPosition; Position = GuardPosition; m_attackSpell = new Spells.FireballSpell(this, 1.7f, AttackRange + 1, EntityTypeRelative.Player); Type |= EntityType.Router; }
IEnumerator Die() { if (!boss) { Instantiate(fallApart, transform.position, transform.rotation); } else { Levels.bossDead = true; } Destroy(this.gameObject); if (!tutorial) { int dropChance = Random.Range(0, 10); // make a drop if (dropChance == 0) { Spells playerSpells = GameObject.Find("Player").GetComponent <Spells>(); int spellDrop = Random.Range(0, playerSpells.spells.Count); Spells.Spell spell = playerSpells.spells[spellDrop]; if (spell.drop && !playerSpells.playerSpells.Contains(spell.spell)) { GameObject d = Instantiate(playerSpells.spells[spellDrop].drop, transform.position, Quaternion.Euler(0, 180, 0)); d.transform.position -= Vector3.up * 0.9f; } } } else { if (tutorialSpell != Spells.SpellsEnum.DASH) { Debug.Log("Test"); Spells playerSpells = GameObject.Find("Player").GetComponent <Spells>(); GameObject d = Instantiate(playerSpells.spellDict[tutorialSpell].drop, transform.position, Quaternion.Euler(0, 180, 0)); } } yield return(null); }
/* * private void Update() * { * if (rightArmState == ArmState.POINTING) * { * wizard.weapon.transform.LookAt(weaponTarget); * } * } */ /* * private void LateUpdate() * { * if (rightArmState == ArmState.POINTING) * { * wizard.weapon.transform.LookAt(weaponTarget); * } * } */ /* * private void OnAnimatorIK() * { * Debug.Log("IIK"); * if (rightArmState == ArmState.POINTING) * { * wizard.weapon.transform.LookAt(weaponTarget); * } * } */ private IEnumerator Cast(Spells.Spell spell) { var enemyHeight = 1.8f; spell.Fire(wizard.weapon, wizard); // Keep the wand pointed at the enemy while (true) { yield return(new WaitForEndOfFrame()); //yield return null; var enemyFeet = wizard.enemy.transform.position; var enemyChest = enemyFeet + (Vector3.up * enemyHeight * 0.8f); var target = (enemyFeet - wizard.weapon.transform.position).normalized + wizard.weapon.transform.position; rightHand.target.position = target; weaponTarget = enemyChest; wizard.weapon.transform.LookAt(weaponTarget); } }
/// <summary> /// Crée une nouvelle instance de SpellcastFireball. /// </summary> public SpellcastBase(Spells.Spell sourceSpell, Spells.SpellCastTargetInfo castInfo) : base() { SourceSpell = sourceSpell; Name = sourceSpell.Name; m_time = 0; m_shape = new Shapes.CircleShape(sourceSpell.SourceCaster.Position, sourceSpell.Description.TargetType.AoeRadius); m_castInfo = castInfo; m_canTouch = false; m_entityIgnoreList = new List <EntityBase>(); if (castInfo.Type == Spells.TargettingType.Targetted) { EntityBase target = GameServer.GetMap().GetEntityById(castInfo.TargetId); if (target == null) { IsDisposing = true; } else { m_initialTargetPos = target.Position; } } }
/// <summary> /// Check if the player can cast a spell to the targeted fighter /// </summary> /// <param name="spell">Casted spell</param> /// <param name="fighter">Targeted fighter</param> /// <returns>False if cannot cast the spell</returns> public bool CanCastSpell(Spells.Spell spell, Fighter fighter, bool NoRangeCheck = false) { return(CanCastSpell(spell, fighter.Cell, NoRangeCheck)); }