Пример #1
0
        public static Spell Create(SpellType spellType)
        {
            Spell newSpell;

            switch (spellType)
            {
                case SpellType.Lightning:
                    newSpell = new Lightning(_content, _graphics);
                    break;
                case SpellType.DragonBreath:
                    newSpell = new DragonBreath(_content, _graphics);
                    break;
                case SpellType.Gate:
                    newSpell = new Gate(_content, _graphics);
                    break;
                case SpellType.Apocalypse:
                    newSpell = new Apocalypse(_content, _graphics);
                    break;
                default:
                    throw new InvalidSpellException(spellType);
            }

            newSpell.Load();
            return newSpell;
        }
Пример #2
0
        public Player(ContentManager content, GraphicsDeviceManager graphics)
        {
            _content = content;
            _graphics = graphics;

            _health = Settings.PlayerMaxHealth;
            Strength = Settings.PlayerMaxStrength;
            Shield = Settings.PlayerMaxShield;
            _magic = Settings.PlayerMaxMagic;

            Score = 0;
            Kills = 0;

            activeSpell = SpellType.DragonBreath;
            activeWeapon = WeaponType.Sword;

            maceAvailable = false;
            axeAvailable = false;

            dying = false;
            Dead = false;
            dyingTick = 0.0f;
            loaded = false;

            Position = Vector3.Zero;
            Direction = 0.0f;

            healthTick = 0.0f;
            shieldTick = 0.0f;

            WeaponPosition = 0.0f;

            model = null;
            rotation = Matrix.Identity;
        }
Пример #3
0
	public void castSpell(SpellType type, Vector3 targetLocation)
	{
		ISpell spell = null;

		switch (type) {
		case SpellType.FIRE:
            if(fireBallSpellPrefab != null)
                 spell = Instantiate (fireBallSpellPrefab) as ISpell;
			break;
		case SpellType.RAIN:
            if(rainSpellPrefab != null)
               spell = Instantiate (rainSpellPrefab) as ISpell;
			break;
        case SpellType.WIND:
            if (windSpellPrefab != null)
                spell = Instantiate(windSpellPrefab) as ISpell;
             break;
		default:
			Debug.LogError ("Invalid Spell Type");
			return;
		}
		if (spell != null) {
			if (successCastSound != null) 
				AudioSource.PlayClipAtPoint (successCastSound, Camera.main.transform.position);
			spell.Activate (_spellList, targetLocation, this.gameObject);
		}
	}
Пример #4
0
 protected Spell(Entity owner, Texture2D icon, SpellType type, int cost)
 {
     Owner = owner;
     powerCost = cost;
     Icon = icon;
     Type = type;
 }
 public void Cast (SpellType spell, Transform player, Transform enemy)
 {
     
     switch (spell)
     {
         case SpellType.clean:
                 CleanWave(player.transform.position);
                 audio.PlayAudio("Clean");
         break;
         case SpellType.buff:
                 BuffTeam(player.gameObject.layer);
                 audio.PlayAudio("Buff");   
         break;
         case SpellType.slow:
                 SlowEnemies(enemy.gameObject.layer);
                 audio.PlayAudio("Slow");   
         break;
         case SpellType.heal:
                 HealTeam(player.gameObject.layer);
                 audio.PlayAudio("Heal");   
         break;
         case SpellType.knockback:
                 KnockEnemies(enemy.gameObject.layer);
                 audio.PlayAudio("Knock");   
         break;
     }
 }
Пример #6
0
	public void CastSpell(ElementType element, SpellType spellType) {
		input.FreezeInput();

		if (spellType == SpellType.Attack) {
			var go = Instantiate(GameManager.Instance.attackEffcts[(int)element]);
			go.name = "Spell";
			go.transform.position = transform.position;
			var spell = go.AddComponent<FlyingSpell>();

			spell.type = spellType;
			spell.element = element;
			spell.ResetTo(this, target);
		} else {
			var go = Instantiate(GameManager.Instance.defendEffcts[(int)element]);
			go.name = "Defense";
			go.transform.position = transform.position;

			var ds = go.AddComponent<DefenseSpell>();
			ds.type = spellType;
			ds.element = element;

			//only one block at a time
			foreach (var defense in defenses) {
				Destructor.DoCleanup(defense.gameObject);
			}
			defenses.Clear();

			defenses.Add(ds);
		}

	}
Пример #7
0
 // Set the curse/spell by id.
 public void SetCurseById(int id)
 {
     spellType = SpellType.unknown;
     if (id == 0 && points.mana >= 40)
     {
         print (HasSheep ());
         if (HasSheep ())
         {
             points.mana -= 40;
             spellType = SpellType.crazy_sheeps;
         }
     }
     else if (id == 1 && points.mana >= 30)
     {
         points.mana -= 30;
         spellType = SpellType.freeze;
     }
     else if (id == 2 && points.mana >= 10)
     {
         points.mana -= 10;
         spellType = SpellType.spawn;
     }
     else if (id == 3 && points.mana >= 30)
     {
         points.mana -= 30;
         spellType = SpellType.wall_block;
     }
     print ("Mana is: " + points.mana);
 }
Пример #8
0
 public static colorstring DescriptionWithIncreasedDamage(SpellType spell)
 {
     switch(spell){
     case SpellType.FORCE_PALM:
         return new colorstring("  2d6",Color.Yellow," damage, range 1, knockback  ",Color.Gray);
     case SpellType.SCORCH:
         return new colorstring("  3d6",Color.Yellow," fire damage, ranged         ",Color.Gray);
     case SpellType.LIGHTNING_BOLT:
         return new colorstring("  3d6",Color.Yellow," electric, leaps between foes",Color.Gray);
     case SpellType.VOLTAIC_SURGE:
         return new colorstring("  4d6",Color.Yellow," electric, radius 2 burst    ",Color.Gray);
     case SpellType.MAGIC_HAMMER:
         return new colorstring("  5d6",Color.Yellow," damage, range 1, stun       ",Color.Gray);
     case SpellType.GLACIAL_BLAST:
         return new colorstring("  4d6",Color.Yellow," cold damage, ranged         ",Color.Gray);
     case SpellType.FLASHFIRE:
         return new colorstring("  4d6",Color.Yellow," fire damage, ranged radius 2",Color.Gray);
     case SpellType.SONIC_BOOM:
         return new colorstring("  4d6",Color.Yellow," magic damage, can stun foes ",Color.Gray);
     case SpellType.COLLAPSE:
         return new colorstring("  5d6",Color.Yellow,", breaks walls, leaves rubble",Color.Gray);
     case SpellType.FORCE_BEAM:
         return new colorstring("  Three ",Color.Gray,"2d6",Color.Yellow," beams knock foes back ",Color.Gray);
     case SpellType.BLIZZARD:
         return new colorstring("  6d6",Color.Yellow," radius 5 burst, freezes foes",Color.Gray);
     default:
         return Description(spell);
     }
 }
Пример #9
0
 public RunescapeSpell(int id, string name, int level, int air, int water, int earth, int fire, int mind,
     int body, int cosmic, int chaos, int astral, int nature, int death, int law, int blood, int soul, double exp,
     SpellCategory category, SpellType spellGroup, string description, params Type[] ingredients)
     : this(id, name, level, air, water, earth, fire, mind, body, cosmic, chaos, astral, nature, death, law, blood,
         soul, exp, category, spellGroup, description, null, ingredients)
 {
 }
Пример #10
0
 public RunescapeSpell(int id, string name, int level, int air, int water, int earth, int fire, int mind,
     int body, int cosmic, int chaos, int astral, int nature, int death, int law, int blood, int soul, double exp,
     SpellCategory category, SpellType spellGroup, string description, Type requiredItem, params Type[] ingredients)
 {
     ID = id;
     Name = name;
     Level = level;
     Air = air;
     Water = water;
     Earth = earth;
     Fire = fire;
     Mind = mind;
     Body = body;
     Cosmic = cosmic;
     Chaos = chaos;
     Astral = astral;
     Nature = nature;
     Death = death;
     Law = law;
     Blood = blood;
     Soul = soul;
     Exp = exp;
     Category = category;
     SpellGroup = spellGroup;
     Description = description;
     RequiredItem = requiredItem;
     Ingredients = ingredients;
 }
Пример #11
0
 public void TakeSpell(SpellType spellType)
 {
     if(spellType == SpellType.FIRE)
     {
         transform.GetChild(0).GetComponent<ParticleSystem>().Play();
         Invoke("BurnDown", 2f);
     }
 }
Пример #12
0
 public Spell(SpellType type, SpellElement element, SpellEffect[] effects, String name, String description)
 {
     this.type = type;
     this.element = element;
     this.effects = effects;
     this.name = name;
     this.description = description;
 }
Пример #13
0
	public Spell CastSpell(SpellType spellType, Vector2 direction){
		DirectionalSpell spell = SpawnSpell(spellType) as DirectionalSpell;
		//spell.transform.position += new Vector3(direction.x, direction.y, 0);
		spell.direction = direction;
		spell.Activate();
		OnSpellCast(spell);
		return spell;
	}
Пример #14
0
	// Just instantiates the spell and sets the spellType and server variables
	private Spell SpawnSpell(SpellType spellType){
		Spell spell = Instantiate(spellType.prefab, transform.position, Quaternion.identity) as Spell;
		spell.spellType = spellType;
		spell.sender = this;
			
		Physics2D.IgnoreCollision(GetComponent<Collider2D>(), spell.GetComponent<Collider2D>(), true);

		return spell;		
	}
Пример #15
0
 public Spell(string name, SpellType type, int damage, int armor, int manaCost, int chance)
 {
     this.Name = name;
     this.Type = type;
     this.Damage = damage;
     this.Armor = armor;
     this.ManaCost = manaCost;
     this.ChanceToCauseAffliction = chance;
 }
Пример #16
0
        public ISSpell()
        {
            _spellLevel = 1;
            _manaCost = 1;
            _cooldown = 1;
            _spellRange = 1;

            spellType = SpellType.None;
        }
Пример #17
0
 public SpellData(string charName, string spellName, string name, int range, int radius, int dangerlevel, SpellType spellType)
 {
     this.charName = charName;
     this.spellName = spellName;
     this.name = name;
     this.range = range;
     this.radius = radius;
     this.dangerlevel = dangerlevel;
     this.spellType = spellType;
 }
Пример #18
0
	public ContactSpell CastContactSpell(SpellType spellType, Unit other){
		// Instantiates the spell and returns it
		// OVerride to add different animations and whatnot
		ContactSpell spell = SpawnSpell(spellType) as ContactSpell;
		spell.target = other;
		spell.Activate();
		OnSpellCast(spell);
		contactSpellCooldown = contactSpellDelay;
		return spell;
	}
Пример #19
0
 public MItem(String name, String menuName, String menuVariable, int id, ItemTypeId type, float range = 0, SpellSlot abilitySlot = SpellSlot.Unknown, SpellType spellType = SpellType.TargetAll)
 {
     this.name = name;
     this.menuVariable = menuVariable;
     this.menuName = menuName;
     this.id = id;
     this.range = range;
     this.type = type;
     this.abilitySlot = abilitySlot;
     this.spellType = spellType;
 }
Пример #20
0
 public static colorstring Description(SpellType spell)
 {
     switch(spell){
     case SpellType.SHINE:
         return new colorstring("  Doubles your torch's radius     ",Color.Gray);
     case SpellType.IMMOLATE:
         return new colorstring("  Throws flame to ignite an enemy ",Color.Gray);
     case SpellType.FORCE_PALM:
         return new colorstring("  1d6 damage, range 1, knockback  ",Color.Gray);
     case SpellType.FREEZE:
         return new colorstring("  Encases an enemy in ice         ",Color.Gray);
     case SpellType.BLINK:
         return new colorstring("  Teleports you a short distance  ",Color.Gray);
     case SpellType.SCORCH:
         return new colorstring("  2d6 fire damage, ranged         ",Color.Gray);
     case SpellType.BLOODSCENT:
         return new colorstring("  Tracks one nearby living enemy  ",Color.Gray);
     case SpellType.LIGHTNING_BOLT:
         return new colorstring("  2d6 electric, leaps between foes",Color.Gray);
     case SpellType.SHADOWSIGHT:
         return new colorstring("  Grants better vision in the dark",Color.Gray);
     case SpellType.VOLTAIC_SURGE:
         return new colorstring("  3d6 electric, radius 2 burst    ",Color.Gray);
     case SpellType.MAGIC_HAMMER:
         return new colorstring("  4d6 damage, range 1, stun       ",Color.Gray);
     case SpellType.RETREAT:
         return new colorstring("  Marks a spot, then returns to it",Color.Gray);
     case SpellType.GLACIAL_BLAST:
         return new colorstring("  3d6 cold damage, ranged         ",Color.Gray);
     case SpellType.PASSAGE:
         return new colorstring("  Move to the other side of a wall",Color.Gray);
     case SpellType.FLASHFIRE:
         return new colorstring("  3d6 fire damage, ranged radius 2",Color.Gray);
     case SpellType.SONIC_BOOM:
         return new colorstring("  3d6 magic damage, can stun foes ",Color.Gray);
     case SpellType.COLLAPSE:
         return new colorstring("  4d6, breaks walls, leaves rubble",Color.Gray);
     case SpellType.FORCE_BEAM:
         return new colorstring("  Three 1d6 beams knock foes back ",Color.Gray);
     case SpellType.AMNESIA:
         return new colorstring("  An enemy forgets your presence  ",Color.Gray);
     case SpellType.BLIZZARD:
         return new colorstring("  5d6 radius 5 burst, freezes foes",Color.Gray);
     case SpellType.BLESS:
         return new colorstring("  Increases Combat skill briefly  ",Color.Gray);
     case SpellType.MINOR_HEAL:
         return new colorstring("  Heals 4d6 damage                ",Color.Gray);
     case SpellType.HOLY_SHIELD:
         return new colorstring("  Attackers take 2d6 magic damage ",Color.Gray);
     default:
         return new colorstring("  Unknown.                        ",Color.Gray);
     }
 }
Пример #21
0
 public SpellClass(int cost, int amount, float cooldown, float castTime, string name, string desc, Spell spell, SpellCategory category, SpellType type)
 {
     this.SpellCost = cost;
     this.SpellAmount = amount;
     this.SpellBaseAmount = amount;
     this.SpellCooldown = cooldown;
     this.SpellBaseCooldown = cooldown;
     this.SpellCastTime = castTime;
     this.SpellBaseCastTime = castTime;
     this.SpellName = name;
     this.SpellDescription = desc;
     this.SpellEnum = spell;
     this.Category = category;
     this.Type = type;
 }
Пример #22
0
 public Hero(SpellType magicSchool, Rectangle rect, Texture2D image, int level)
 {
     this.Health = STARTING_HEALTH;
     this.Mana = STARTING_MANA;
     this.Armor = STARTING_ARMOR;
     this.MaxHealth = STARTING_HEALTH;
     this.MaxMana = STARTING_MANA;
     this.MagicSchool = magicSchool;
     this.Affliction = Enumerations.Affliction.None;
     this.ExperienceNeeded = 200;
     this.Bounds = rect;
     this.Texture = image;
     this.Level = level;
     this.HasBeenHit = false;
     this.HasWon = false;
     this.Turns = 2;
     this.HasBeenAfflicted = false;
 }
Пример #23
0
 public SpellData(
     string charName,
     string spellName,
     string name,
     int range,
     int radius,
     SpellDatabase.SpellDangerLevel dangerlevel,
     SpellType spellType
     )
 {
     CharName = charName;
     SpellName = spellName;
     Name = name;
     Range = range;
     Radius = radius;
     Dangerlevel = dangerlevel;
     SpellType = spellType;
 }
Пример #24
0
    public bool CheckType(SpellType type, bool p1)
    {
        if (p1){_p1Check = true;}else{_p2Check = true;}

        if(_type == SpellType.NEW)
        {
            SetType(type);
            return true;
        }
        else
        {
            if( _type == type)
            {
                this.GetComponentInChildren<Animator>().SetTrigger("Blink");
                return true;
            }
        }

        return false;
    }
Пример #25
0
        public static colorstring DescriptionWithIncreasedDamage(SpellType spell)
        {
            switch (spell)
            {
            case SpellType.FORCE_PALM:
                return(new colorstring("  2d6", Color.Yellow, " damage, range 1, knockback  ", Color.Gray));

            case SpellType.SCORCH:
                return(new colorstring("  3d6", Color.Yellow, " fire damage, ranged         ", Color.Gray));

            case SpellType.LIGHTNING_BOLT:
                return(new colorstring("  3d6", Color.Yellow, " electric, leaps between foes", Color.Gray));

            case SpellType.VOLTAIC_SURGE:
                return(new colorstring("  4d6", Color.Yellow, " electric, radius 2 burst    ", Color.Gray));

            case SpellType.MAGIC_HAMMER:
                return(new colorstring("  5d6", Color.Yellow, " damage, range 1, stun       ", Color.Gray));

            case SpellType.GLACIAL_BLAST:
                return(new colorstring("  4d6", Color.Yellow, " cold damage, ranged         ", Color.Gray));

            case SpellType.FLASHFIRE:
                return(new colorstring("  4d6", Color.Yellow, " fire damage, ranged radius 2", Color.Gray));

            case SpellType.SONIC_BOOM:
                return(new colorstring("  4d6", Color.Yellow, " magic damage, can stun foes ", Color.Gray));

            case SpellType.COLLAPSE:
                return(new colorstring("  5d6", Color.Yellow, ", breaks walls, leaves rubble", Color.Gray));

            case SpellType.FORCE_BEAM:
                return(new colorstring("  Three ", Color.Gray, "2d6", Color.Yellow, " beams knock foes back ", Color.Gray));

            case SpellType.BLIZZARD:
                return(new colorstring("  6d6", Color.Yellow, " radius 5 burst, freezes foes", Color.Gray));

            default:
                return(Description(spell));
            }
        }
Пример #26
0
 public SpellBase(SpellSlot slot, SpellType?type, int range = int.MaxValue)
 {
     Slot         = slot;
     Type         = type ?? SpellType.Self;
     Range        = range;
     Game.OnTick += delegate
     {
         if (FpsBooster.CanBeExecuted(CalculationType.Prediction))
         {
         }
         foreach (var pair in CachedPredictions)
         {
             pair.Value.Clear();
         }
         if (FpsBooster.CanBeExecuted(CalculationType.Damage))
         {
             _cachedDamage.Clear();
         }
         if (FpsBooster.CanBeExecuted(CalculationType.HealthPrediction))
         {
             _killableMinions.Clear();
         }
         if (FpsBooster.CanBeExecuted(CalculationType.IsValidTarget))
         {
         }
         foreach (var pair in _cachedObjectsInRange)
         {
             pair.Value.Clear();
         }
         foreach (var pair in _cachedIsOnSegment.SelectMany(pair => pair.Value))
         {
             pair.Value.Clear();
         }
         EnemyHeroesCanBeCalculated      = true;
         LaneClearMinionsCanBeCalculated = true;
         EnemyMinionsCanBeCalculated     = true;
         MonstersCanBeCalculated         = true;
         _bestObjectInLine.Hits          = 0;
         _bestCircularObject.Hits        = 0;
     };
 }
Пример #27
0
        void NavigateItems(SpellType type)
        {
            Option selected = null;

            while (selected != Optionhandler.Exit)
            {
                List <Spell> Spells = this.getSpells(type);
                if (Spells.Count == 0)
                {
                    return;
                }
                printHeader();
                Optionhandler OH = new Optionhandler(true);
                OH.setName("Spellbook.Spell");
                foreach (Spell i in Spells)
                {
                    OH.AddOption(i);
                }
                selected = OH.selectOption(false);
            }
        }
Пример #28
0
        public static SpellHueEntry GetSpellHueEntry(PlayerMobile player, SpellType spellType)
        {
            SpellHueEntry entry = null;

            if (player == null)
            {
                return(entry);
            }

            EnhancementsPersistance.CheckAndCreateEnhancementsAccountEntry(player);

            foreach (SpellHueEntry playerEntry in player.m_EnhancementsAccountEntry.m_SpellHues)
            {
                if (playerEntry.m_SpellType == spellType)
                {
                    return(playerEntry);
                }
            }

            return(entry);
        }
Пример #29
0
 public SpellUsage(
     string name,
     Spell.SpellBase spell,
     DamageType damageType,
     Func <bool> preCondition,
     Func <AIHeroClient, bool> heroCondition,
     Func <Obj_AI_Minion, bool> minionCondition,
     HitChance hitChance,
     bool checkTarget)
 {
     // Initialize properties
     Name            = name ?? "Use " + spell.Slot;
     Spell           = spell;
     DamageType      = damageType;
     PreCondition    = preCondition;
     HeroCondition   = heroCondition;
     MinionCondition = minionCondition;
     HitChance       = hitChance;
     CheckTarget     = checkTarget;
     Type            = SpellTypeDictionary[spell.GetType()];
 }
Пример #30
0
    public void UpdateChargesUI(SpellType _t, string _value)
    {
        switch (_t)
        {
        case SpellType.Earth:
            images[1].GetComponentInChildren <TMP_Text>().text = _value.ToString();
            break;

        case SpellType.Wind:
            images[2].GetComponentInChildren <TMP_Text>().text = _value.ToString();
            break;

        case SpellType.Light:
            images[3].GetComponentInChildren <TMP_Text>().text = _value.ToString();
            break;

        case SpellType.Shrink:
            images[0].GetComponentInChildren <TMP_Text>().text = _value.ToString();
            break;
        }
    }
Пример #31
0
    private void CheckSpells()
    {
        int spellInt = control.GetSpellButtons();

        if (spellInt != -1)
        {
            SpellType spell = (SpellType)spellInt;
            character.activeSpell = spell;
            foreach (var s in spellUI.spellButtons)
            {
                if (s.spellType == spell)
                {
                    s.SetActive();
                }
                else
                {
                    s.SetTransparent();
                }
            }
        }
    }
Пример #32
0
    public void UpdateEmptyCharges(SpellType _t, float _value)
    {
        switch (_t)
        {
        case SpellType.Earth:
            images[1].fillAmount = _value;
            break;

        case SpellType.Wind:
            images[2].fillAmount = _value;
            break;

        case SpellType.Light:
            images[3].fillAmount = _value;
            break;

        case SpellType.Shrink:
            images[0].fillAmount = _value;
            break;
        }
    }
Пример #33
0
        public static SkillShotType type(SpellType spelltype)
        {
            switch (spelltype)
            {
            case SpellType.Circle:
            case SpellType.MissileAoe:
            case SpellType.Self:
                return(SkillShotType.Circular);

            case SpellType.Line:
            case SpellType.Arc:
            case SpellType.MissileLine:
                return(SkillShotType.Linear);

            case SpellType.Cone:
            case SpellType.Ring:
                return(SkillShotType.Cone);

            default:
                return(SkillShotType.Linear);
            }
        }
Пример #34
0
    public void CastSpell(SpellType type, Gesture.GestureHand hand)
    {
        bool left = false;

        if (hand == Gesture.GestureHand.LEFT)
        {
            left = true;
        }

        Spell spell = null;

        switch (type)
        {
        case SpellType.ONE_QUICK:
            spell = QuickSpell(left);
            break;

        case SpellType.ONE_HEAVY:
            spell = HeavySpell(left);
            break;

        case SpellType.ONE_SPECIAL:
            spell = SpecialSpell(left);
            break;

        case SpellType.TWO_DEFENSE:
            spell = DefenseSpell();
            break;

        case SpellType.TWO_OFFENSE:
            spell = OffenseSpell();
            break;
        }

        if (spell != null)
        {
            spell.Cast(player, left);
        }
    }
Пример #35
0
    void ClearLine(List <Sc_Tile> tiles)
    {
        foreach (var tile in tiles)
        {
            tile.Death();
            SpellType spellType = tile.currentSpell;

            if (allSpellEffects.ContainsKey(spellType))
            {
                allSpellEffects[spellType].Effect(tiles);
                Sc_EventManager.instance.onUpdateStats.Invoke();
            }
        }

        for (int i = 2; i < tiles.Count; i++)
        {
            tiles[i].myTileEffect.Effect(tiles);
            Sc_EventManager.instance.onUpdateStats.Invoke();
        }

        StartCoroutine(GenerateGrid(true));
    }
Пример #36
0
        public ShotSprite(SpellType type)
        {
            Type = type;
            switch (type)
            {
            case SpellType.Hero:
                Texture = SKTexture.FromImageNamed(SHOT_HERO_PATH);
                break;

            case SpellType.Enemy:
                Texture = SKTexture.FromImageNamed(SHOT_ENEMY_PATH);
                break;
            }
            Size        = Texture.Size;
            PhysicsBody = SKPhysicsBody.CreateRectangularBody(Size);
            PhysicsBody.CategoryBitMask    = CollisionCategory.Spell;
            PhysicsBody.ContactTestBitMask = CollisionCategory.Enemy | CollisionCategory.Platform;
            PhysicsBody.CollisionBitMask   = 0;
            PhysicsBody.AffectedByGravity  = false;
            PhysicsBody.AngularDamping     = 0;
            PhysicsBody.AllowsRotation     = false;
        }
Пример #37
0
        /*****************************
        *          Methods          *
        *****************************/
        public void Initialise(int position, float spacing, SpellType typeOfSpell, bool useJoint, int ignoreInstanceId)
        {
            _position         = position;
            _spacing          = spacing;
            type              = typeOfSpell;
            _useJoint         = useJoint;
            _lerpStart        = pointLight.intensity;
            _ignoreInstanceId = ignoreInstanceId;
            switch (type)
            {
            case SpellType.Red:
                spellSprite.color  = effectColours.red;
                pointLight.color   = effectColours.red;
                spellSprite.sprite = spellSprites.red;
                break;

            case SpellType.Green:
                spellSprite.color  = effectColours.green;
                pointLight.color   = effectColours.green;
                spellSprite.sprite = spellSprites.green;
                break;

            case SpellType.Blue:
                spellSprite.color  = effectColours.blue;
                pointLight.color   = effectColours.blue;
                spellSprite.sprite = spellSprites.blue;
                break;

            case SpellType.Yellow:
                spellSprite.color  = effectColours.yellow;
                pointLight.color   = effectColours.yellow;
                spellSprite.sprite = spellSprites.yellow;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Пример #38
0
        public static int Tier(SpellType spell)
        {
            switch (spell)
            {
            case SpellType.RADIANCE:
            case SpellType.FORCE_PALM:
            case SpellType.DETECT_MOVEMENT:
            case SpellType.FLYING_LEAP:
                return(1);

            case SpellType.MERCURIAL_SPHERE:
            case SpellType.GREASE:
            case SpellType.BLINK:
            case SpellType.FREEZE:
                return(2);

            case SpellType.SCORCH:
            case SpellType.LIGHTNING_BOLT:
            case SpellType.MAGIC_HAMMER:
            case SpellType.PORTAL:
                return(3);

            case SpellType.PASSAGE:
            case SpellType.AMNESIA:
            case SpellType.STONE_SPIKES:
            case SpellType.SHADOWSIGHT:
                return(4);

            case SpellType.BLIZZARD:
            case SpellType.COLLAPSE:
            case SpellType.DOOM:
            case SpellType.TELEKINESIS:
                return(5);

            default:
                return(5);
            }
        }
Пример #39
0
    public Spell DrawSpellByType(SpellType t)
    {
        List <Spell> matching = new List <Spell>();

        foreach (Spell s in spellPool)
        {
            if (s.type == t)
            {
                matching.Add(s);
            }
        }

        if (matching.Count == 0)
        {
            return(null);
        }

        int   index = Random.Range(0, matching.Count);
        Spell spell = matching[index];

        spellPool.Remove(spell);
        return(spell);
    }
Пример #40
0
 public void Attack(int damage, SpellType spellType = SpellType.None, bool lifesteal = false)
 {
     damage += playerCharacter.GetEmpoweredDamage();
     if (playerCharacter.IsBlinded() && Random.Range(0, 4) == 0)
     {
         Debug.Log(playerCharacter.name + " misses the attack because of blind effect.");
         return;
     }
     if (playerCharacter.IsConfused() && Random.Range(0, 5) == 0)
     {
         playerCharacter.DecreaseHealthBySpellDamage(damage, spellType);
         Debug.Log("In it's confusion " + playerCharacter.name + "'s attack backfires.");
     }
     else
     {
         enemyTarget.DecreaseHealthBySpellDamage(damage, spellType);
     }
     if (lifesteal)
     {
         playerCharacter.IncreaseHealth(damage / 2);
     }
     playerCharacter.SetEmpowered(0);
 }
Пример #41
0
    public void SpellCollected(PlayerController player, SpellType spellType)
    {
        Debug.Log("Player " + player.PlayerID + " collected spell " + spellType);


        if (spellType == SpellType.Balloon)
        {
            BalloonSpell.UseSpell(player);
        }
        else if (spellType == SpellType.Random)
        {
            SpellType randomSpell = RandomSpell.UseSpell(player);
            SpellCollected(player, randomSpell);
            return;
        }
        else
        {
            GameController.Instance.SpellController.AddSpellToPlayer(spellType, player);
        }

        LeanTween.cancel(_waveAnimation.uniqueId);
        Destroy(gameObject);
    }
Пример #42
0
    private void CreateVisualEffect(SpellType type, Tile t)
    {
        GameObject visEffec = null;

        switch (type)
        {
        case SpellType.FireBall:
            visEffec = (GameObject)Instantiate(PrefabManager.instance.flameAnimationPrefab);
            break;

        case SpellType.LightningBolt:
            visEffec = (GameObject)Instantiate(PrefabManager.instance.lightningBoltAnimationPrefab);
            break;

        default:
            break;
        }

        if (visEffec != null)
        {
            visEffec.transform.position = new Vector3(t.position.x, t.position.y, GameMaster.instance.playerZLevel - 0.1f);
        }
    }
Пример #43
0
    private StatusEffect DecideStatusEffect(SpellType type)
    {
        StatusEffect effect = null;

        switch (type)
        {
        case SpellType.Rejuvenation:
            effect = StatusEffect.CreateEffect(StatusEffect.EffectType.Healing, statusDamage, statusDuration);
            break;

        case SpellType.FireBall:
            effect = StatusEffect.CreateEffect(StatusEffect.EffectType.Burning, statusDamage, statusDuration);
            break;

        case SpellType.LightningBolt:

            break;

        default:
            break;
        }
        return(effect);
    }
Пример #44
0
        void ApplyStat(SpellType st, Researchables stat, float percent)
        {
            var temp_stat = Spell_Stats.Empty();

            switch (stat)
            {
            case Researchables.SPower:
                var mod = Extensions.Extensions.PercentT(spell_data[st].Damage, percent);
                temp_stat.Damage += mod;
                spell_data[st]   += temp_stat;
                break;

            case Researchables.SCost:
                temp_stat.Cost += Extensions.Extensions.PercentT(spell_data[st].Cost, percent);
                spell_data[st] -= temp_stat;
                break;

            case Researchables.SLength:
                temp_stat.Duration += (int)Extensions.Extensions.PercentT(spell_data[st].Duration, percent);
                spell_data[st]     += temp_stat;
                break;
            }
        }
Пример #45
0
 public void SetType(SpellType type)
 {
     _type = type;
     _oldSprite.SetActive(false);
     switch (_type)
     {
         case SpellType.UP:
             GetComponentInChildren<SpriteRenderer>().sprite = _image[0];
             break;
         case SpellType.DOWN:
             GetComponentInChildren<SpriteRenderer>().sprite = _image[1];
             break;
         case SpellType.LEFT:
             GetComponentInChildren<SpriteRenderer>().sprite = _image[2];
             break;
         case SpellType.RIGHT:
             GetComponentInChildren<SpriteRenderer>().sprite = _image[3];
             break;
         default:
             break;
     }
     this.GetComponentInChildren<Animator>().SetTrigger("Blink");
 }
Пример #46
0
        private bool ServerMessage_0x17_SpellSlotAdded(Client client, ServerPacket msg)
        {
            try
            {
                byte slot = msg.ReadByte();
                msg.ReadUInt16();
                msg.ReadByte();
                string index = msg.ReadString8();
                msg.ReadString8();
                byte lines = msg.ReadByte();
                if (index.Contains("ard cradh") || index.Contains("ard ioc") || index.Contains("mor dion"))
                {
                    client.Base.Caster = true;
                }
                SpellType spellType = (int)slot > 36 ? ((int)slot > 72 ? SpellType.Common : SpellType.Medenia) : SpellType.Temuair;
                if (!client.Base.Spells.ContainsKey(index))
                {
                    client.Base.Spells.Add(index, new Spell(index, slot, lines)
                    {
                        type = spellType
                    });
                }
                else
                {
                    client.Base.Spells[index].Lines = lines;
                }

                /*does it update the lines as you change your staff?
                 * IE: will it say all spells are one line if we have a rod of ages equipped? must check*/
                return(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
                return(false);
            }
        }
Пример #47
0
        public static int GetMobileSpellHue(Mobile mobile, SpellType spellType)
        {
            int hue = 0;

            BaseCreature bc_Creature = mobile as BaseCreature;

            if (bc_Creature != null)
            {
                return(bc_Creature.SpellHue);
            }

            PlayerMobile player = mobile as PlayerMobile;

            if (player == null)
            {
                return(hue);
            }

            EnhancementsPersistance.CheckAndCreateEnhancementsAccountEntry(player);

            foreach (Enhancements.SpellHueEntry entry in player.m_EnhancementsAccountEntry.m_SpellHues)
            {
                if (entry == null)
                {
                    continue;
                }

                if (entry.m_SpellType == spellType)
                {
                    Enhancements.SpellHueTypeDetail hueTypeDetail = Enhancements.GetSpellHueTypeDetail(entry.m_SelectedHue);

                    return(hueTypeDetail.m_SpellHue);
                }
            }

            return(hue);
        }
Пример #48
0
    public void SwitchType(SpellType _t)
    {
        typeSpell = _t;

        switch (typeSpell)
        {
        case SpellType.Line:
            rend.sprite = lineSprite;

            //rend.color = Color.yellow;
            break;

        case SpellType.Wall:
            rend.sprite = wallSprite;

            //rend.color = Color.grey;
            break;

        case SpellType.Cone:
            rend.sprite = coneSprite;

            //rend.color = Color.blue;
            break;

        case SpellType.Area:
            rend.sprite = areaSprite;

            //rend.color = Color.red;
            break;

        case SpellType.Nova:
            rend.sprite = novaSprite;

            //rend.color = Color.cyan;
            break;
        }
    }
Пример #49
0
    public void Attack(int minDmg, int maxDmg, SpellType spellType = SpellType.None, bool lifesteal = false)
    {
        int damage = Random.Range(minDmg, maxDmg + 1) + character.GetEmpoweredDamage();

        if (character.IsBlinded() && Random.Range(0, 4) == 0)
        {
            Debug.Log(character.name + " misses the attack because of blind effect.");
            return;
        }
        if (character.IsConfused() && Random.Range(0, 5) == 0)
        {
            character.DecreaseHealthBySpellDamage(damage, spellType);
            Debug.Log("In it's confusion " + character.name + "'s attack backfires.");
        }
        else
        {
            target.DecreaseHealthBySpellDamage(damage, spellType);
            if (lifesteal)
            {
                character.IncreaseHealth(damage / 2);
            }
        }
        character.SetEmpowered(0);
    }
Пример #50
0
        /// <summary>
        ///     Returns the SDK alternative to the LeagueSharp.Data SpellType.
        /// </summary>
        /// <param name="spellType">The LeagueSharp.Data SpellType</param>
        /// <returns>The SDK SpellType</returns>
        public static SkillshotType GetSkillshotTypeFromSpellType(SpellType spellType)
        {
            switch (spellType)
            {
            case SpellType.SkillshotArc:
                return(SkillshotType.SkillshotCone);

            case SpellType.SkillshotCone:
                return(SkillshotType.SkillshotCone);

            case SpellType.SkillshotCircle:
                return(SkillshotType.SkillshotCircle);

            case SpellType.SkillshotLine:
                return(SkillshotType.SkillshotLine);

            case SpellType.SkillshotMissileArc:
                return(SkillshotType.SkillshotCone);

            case SpellType.Position:
                return(SkillshotType.SkillshotLine);

            case SpellType.SkillshotMissileCircle:
                return(SkillshotType.SkillshotCircle);

            case SpellType.SkillshotMissileLine:
                return(SkillshotType.SkillshotLine);

            case SpellType.SkillshotMissileCone:
                return(SkillshotType.SkillshotCircle);

            case SpellType.SkillshotRing:
                return(SkillshotType.SkillshotCircle);
            }
            return(SkillshotType.SkillshotLine);
        }
Пример #51
0
    // set the element type of the spell
    //and update the material used by the renderer
    void setSpellProperties(Dictionary<int, object> spellParams)
    {
        parent = (Transform)spellParams[(int)SpellParameter.parent];
        spellType = (SpellType)spellParams[(int)SpellParameter.type];
        spellElem = (SpellElement)spellParams[(int)SpellParameter.element];

        if(spellType == SpellType.offensive){
            spellDamage *= (float)spellParams[(int)SpellParameter.damageMultiplier];

            gameObject.name = "offensiveSpell";
            oSpellBehave.enabled = true;
            renderer.material = spellMat[(int)spellElem];
            trail.renderer.material = trailMat[(int)spellElem];
            Destroy(dSpellBehave);
        //Defensice spell
        }else{
            gameObject.name = "defensiveSpell";
            dSpellBehave.enabled = true;
            renderer.enabled = false;
            transform.parent = parent;
            Destroy(oSpellBehave);
            Destroy(trail);
        }
    }
Пример #52
0
    public static void castSpell(SpellBook spellBook, Vector3 position, Quaternion rotation)
    {
        Object    prefab    = instance.fireBall;
        SpellType spellType = SpellType.Damage;

        switch (spellBook)
        {
        case SpellBook.FireBall:
            prefab    = instance.fireBall;
            spellType = SpellType.Damage;
            break;

        case SpellBook.IceBlitz:
            prefab    = instance.iceBlitz;
            spellType = SpellType.Damage;
            break;
        }

        Vector3 offset = rotation * Vector3.forward * GameManager.TileSize / 2f;
        var     o      = Object.Instantiate(prefab, position + offset, rotation) as GameObject;
        Spell   spell  = o.GetComponent <Spell>();

        spell.Initialize(spellType);
    }
Пример #53
0
    //defensive heal spell
    public void Heal()
    {
        string    spellName = "heal";
        int       manaCost  = 5;
        SpellType spellType = SpellType.HealingTarget;
        float     healing   = CombatEntity.DamageAmount((int)Math.Round(casterObj.attributes.magicTotal * 0.2f), (int)Math.Round(casterObj.attributes.magicTotal * 0.8f), casterObj.attributes.magicTotal, 1.0f);

        if (GameManager.IsCombat())
        {
            SpellTemplate(spellName, healing, manaCost, spellType);
        }
        else
        {
            //learn spell
            try
            {
                spellDictionary.Add(spellName, new spell(Heal));
            }
            catch (ArgumentException)
            {
                Console.WriteLine("You already know the spell " + spellName);
            }
        }
    }
Пример #54
0
 public InvalidSpellException(SpellType spellType)
     : base("Invalid spell type: " + spellType.ToString())
 {
 }
Пример #55
0
        public static void CreateSpellData(Obj_AI_Base hero, Vector3 spellStartPos, Vector3 spellEndPos,
                                           SpellData spellData, GameObject obj = null, float extraEndTick = 0.0f, bool processSpell = true,
                                           SpellType spellType = SpellType.None, bool checkEndExplosion   = true, float spellRadius = 0)
        {
            if (checkEndExplosion && spellData.hasEndExplosion)
            {
                CreateSpellData(hero, spellStartPos, spellEndPos,
                                spellData, obj, extraEndTick, false,
                                spellData.spellType, false);

                CreateSpellData(hero, spellStartPos, spellEndPos,
                                spellData, obj, extraEndTick, true,
                                SpellType.Circular, false);

                return;
            }

            if (spellStartPos.Distance(myHero.Position) < spellData.range + 1000)
            {
                Vector2 startPosition = spellStartPos.To2D();
                Vector2 endPosition   = spellEndPos.To2D();
                Vector2 direction     = (endPosition - startPosition).Normalized();
                float   endTick       = 0;

                if (spellType == SpellType.None)
                {
                    spellType = spellData.spellType;
                }

                if (spellData.fixedRange) //for diana q
                {
                    if (endPosition.Distance(startPosition) > spellData.range)
                    {
                        //var heroCastPos = hero.ServerPosition.To2D();
                        //direction = (endPosition - heroCastPos).Normalized();
                        endPosition = startPosition + direction * spellData.range;
                    }
                }

                if (spellType == SpellType.Line)
                {
                    endTick     = spellData.spellDelay + (spellData.range / spellData.projectileSpeed) * 1000;
                    endPosition = startPosition + direction * spellData.range;

                    if (spellData.useEndPosition)
                    {
                        var range = spellEndPos.To2D().Distance(spellStartPos.To2D());
                        endTick     = spellData.spellDelay + (range / spellData.projectileSpeed) * 1000;
                        endPosition = spellEndPos.To2D();
                    }

                    if (obj != null)
                    {
                        endTick -= spellData.spellDelay;
                    }
                }
                else if (spellType == SpellType.Circular)
                {
                    endTick = spellData.spellDelay;

                    if (spellData.projectileSpeed == 0)
                    {
                        endPosition = hero.ServerPosition.To2D();
                    }
                    else if (spellData.projectileSpeed > 0)
                    {
                        if (spellData.spellType == SpellType.Line &&
                            spellData.hasEndExplosion &&
                            spellData.useEndPosition == false)
                        {
                            endPosition = startPosition + direction * spellData.range;
                        }

                        endTick = endTick + 1000 * startPosition.Distance(endPosition) / spellData.projectileSpeed;
                    }
                }
                else if (spellType == SpellType.Arc)
                {
                    endTick = endTick + 1000 * startPosition.Distance(endPosition) / spellData.projectileSpeed;

                    if (obj != null)
                    {
                        endTick -= spellData.spellDelay;
                    }
                }
                else if (spellType == SpellType.Cone)
                {
                    return;
                }
                else
                {
                    return;
                }

                endTick += extraEndTick;

                Spell newSpell = new Spell();

                newSpell.startTime = EvadeUtils.TickCount;
                newSpell.endTime   = EvadeUtils.TickCount + endTick;
                newSpell.startPos  = startPosition;
                newSpell.endPos    = endPosition;
                newSpell.height    = spellEndPos.Z + spellData.extraDrawHeight;
                newSpell.direction = direction;
                newSpell.heroID    = hero.NetworkId;
                newSpell.info      = spellData;
                newSpell.spellType = spellType;
                newSpell.radius    = spellRadius > 0 ? spellRadius : newSpell.GetSpellRadius();

                if (obj != null)
                {
                    newSpell.spellObject  = obj;
                    newSpell.projectileID = obj.NetworkId;
                }

                int spellID = CreateSpell(newSpell, processSpell);

                DelayAction.Add((int)(endTick + spellData.extraEndTime), () => DeleteSpell(spellID));
            }
        }
Пример #56
0
 public void ShootPhys(Entity target)
 {
     _nextSpell = SpellType.PHYSICAL;
     launchSpell(target, _nextSpell);
 }
Пример #57
0
 public SpellData(string charName, string spellName, string name, int range, int radius, int dangerlevel, SpellType spellType)
 {
     CharName    = charName;
     SpellName   = spellName;
     Name        = name;
     Range       = range;
     Radius      = radius;
     Dangerlevel = dangerlevel;
     SpellType   = spellType;
 }
Пример #58
0
        public static void CreateSpellData(Obj_AI_Base hero, Vector3 spellStartPos, Vector3 spellEndPos,
            SpellData spellData, GameObject obj = null, float extraEndTick = 0.0f, bool processSpell = true,
            SpellType spellType = SpellType.None, bool checkEndExplosion = true, float spellRadius = 0)
        {
            if (checkEndExplosion && spellData.hasEndExplosion)
            {
                CreateSpellData(hero, spellStartPos, spellEndPos,
            spellData, obj, extraEndTick, false,
            spellData.spellType, false);

                CreateSpellData(hero, spellStartPos, spellEndPos,
            spellData, obj, extraEndTick, true,
            SpellType.Circular, false);

                return;
            }

            if (spellStartPos.LSDistance(myHero.Position) < spellData.range + 1000)
            {
                Vector2 startPosition = spellStartPos.LSTo2D();
                Vector2 endPosition = spellEndPos.LSTo2D();
                Vector2 direction = (endPosition - startPosition).LSNormalized();
                float endTick = 0;

                if (spellType == SpellType.None)
                {
                    spellType = spellData.spellType;
                }

                if (spellData.fixedRange) //for diana q
                {
                    if (endPosition.LSDistance(startPosition) > spellData.range)
                    {
                        //var heroCastPos = hero.ServerPosition.LSTo2D();
                        //direction = (endPosition - heroCastPos).LSNormalized();
                        endPosition = startPosition + direction * spellData.range;
                    }
                }

                if (spellType == SpellType.Line)
                {
                    endTick = spellData.spellDelay + (spellData.range / spellData.projectileSpeed) * 1000;
                    endPosition = startPosition + direction * spellData.range;

                    if (spellData.useEndPosition)
                    {
                        var range = spellEndPos.LSTo2D().LSDistance(spellStartPos.LSTo2D());
                        endTick = spellData.spellDelay + (range / spellData.projectileSpeed) * 1000;
                        endPosition = spellEndPos.LSTo2D();
                    }

                    if (obj != null)
                        endTick -= spellData.spellDelay;
                }
                else if (spellType == SpellType.Circular)
                {
                    endTick = spellData.spellDelay;

                    if (spellData.projectileSpeed == 0)
                    {
                        endPosition = hero.ServerPosition.LSTo2D();
                    }
                    else if (spellData.projectileSpeed > 0)
                    {
                        if (spellData.spellType == SpellType.Line &&
                            spellData.hasEndExplosion &&
                            spellData.useEndPosition == false)
                        {
                            endPosition = startPosition + direction * spellData.range;
                        }

                        endTick = endTick + 1000 * startPosition.LSDistance(endPosition) / spellData.projectileSpeed;
                    }
                }
                else if (spellType == SpellType.Arc)
                {
                    endTick = endTick + 1000 * startPosition.LSDistance(endPosition) / spellData.projectileSpeed;

                    if (obj != null)
                        endTick -= spellData.spellDelay;
                }
                else if (spellType == SpellType.Cone)
                {
                    return;
                }
                else
                {
                    return;
                }

                if (spellData.invert)
                {
                    var dir = (startPosition - endPosition).LSNormalized();
                    endPosition = startPosition + dir * startPosition.LSDistance(endPosition);
                }

                if (spellData.isPerpendicular)
                {
                    startPosition = spellEndPos.LSTo2D() - direction.LSPerpendicular() * spellData.secondaryRadius;
                    endPosition = spellEndPos.LSTo2D() + direction.LSPerpendicular() * spellData.secondaryRadius;
                }

                endTick += extraEndTick;

                Spell newSpell = new Spell();

                newSpell.startTime = EvadeUtils.TickCount;
                newSpell.endTime = EvadeUtils.TickCount + endTick;
                newSpell.startPos = startPosition;
                newSpell.endPos = endPosition;
                newSpell.height = spellEndPos.Z + spellData.extraDrawHeight;
                newSpell.direction = direction;
                newSpell.heroID = hero.NetworkId;
                newSpell.info = spellData;
                newSpell.spellType = spellType;
                newSpell.radius = spellRadius > 0 ? spellRadius : newSpell.GetSpellRadius();

                if (obj != null)
                {
                    newSpell.spellObject = obj;
                    newSpell.projectileID = obj.NetworkId;
                }

                int spellID = CreateSpell(newSpell, processSpell);

                DelayAction.Add((int)(endTick + spellData.extraEndTime), () => DeleteSpell(spellID));
            }
        }
 public TargetSpellData(string champion, string name, SpellSlot slot, SpellType type, CcType cc, float range,
     float delay, float speed)
 {
     ChampionName = champion;
     Name = name;
     Spellslot = slot;
     Type = type;
     CcType = cc;
     Range = range;
     Speed = speed;
     Delay = delay;
 }
Пример #60
0
 public static List<SpellClass> GetSpellTypes(SpellType type)
 {
     return AllSpells.FindAll(item => type == item.Type);
 }