Spell effects modify how the spell behaves. For example the missile motor will control how the spell will move through space while the beam motor will raycast a beam through world space. Spell effects are intended to be drivers for the actual spell and will not execute spell logic.
Inheritance: MonoBehaviour
Ejemplo n.º 1
0
Archivo: Summon.cs Proyecto: NVN/WCell
		public SummonEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
			// MiscValueB:
			// 41 -> NonCombat Companion
			// 
		}
Ejemplo n.º 2
0
		public NotImplementedEffect(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
			if (cast.Caster is Character)
			{
				(cast.Caster as Character).SendSystemMessage(
					"Spell {0} ({1}) has not implemented Effect {2}. Please report this to the developers",
					cast.Spell.Name, cast.Spell.Id, effect.EffectType);
			}
		}
Ejemplo n.º 3
0
 //Use this to check whether an effect is already on someone, then just refresh the duration if it is
 public bool Equals(SpellEffect otherEffect)
 {
     if (instantDamage == otherEffect.instantDamage && instantKnockback == otherEffect.instantKnockback && maxHealthMod == otherEffect.maxHealthMod
         && healthRegenMod == otherEffect.healthRegenMod && damageReductionMod == otherEffect.damageReductionMod && maxManaMod == otherEffect.maxManaMod
         && manaRegenMod == otherEffect.manaRegenMod && damageMod == otherEffect.damageMod && attackTimeMod == otherEffect.attackTimeMod
         && knockbackMod == otherEffect.knockbackMod && speedMod == otherEffect.speedMod && jumpSpeedMod == otherEffect.jumpSpeedMod)
     {
         //All the effects are equal
         return true;
     } else {
         //One or more effects is not equal
         return false;
     }
 }
Ejemplo n.º 4
0
 public override bool EquipEvent(int slotNo)
 {
     if ((slotNo ==9) || (slotNo ==10))
     {
         if (objInt().isEnchanted==true)
         {
             //cast enchantment.
             SpellEffectApplied = GameWorldController.instance.playerUW.PlayerMagic.CastEnchantment(GameWorldController.instance.playerUW.gameObject,null,GetActualSpellIndex(),Magic.SpellRule_TargetSelf);
             if (SpellEffectApplied!=null)
             {
                 SpellEffectApplied.SetPermanent(true);
             }
         }
     }
     return true;
 }
Ejemplo n.º 5
0
    //For creating spells from templates -- necessary because when I tried
    //setting ProjectileSpell's effect field equal to the template effect,
    //it was a reference instead of a variable
    public SpellEffect(SpellEffect templateEffect)
    {
        instantDamage = templateEffect.instantDamage;
        instantKnockback = templateEffect.instantKnockback;

        maxHealthMod = templateEffect.maxHealthMod;
        healthRegenMod = templateEffect.healthRegenMod;
        damageReductionMod = templateEffect.damageReductionMod;
        maxManaMod = templateEffect.maxManaMod;
        damageMod = templateEffect.damageMod;
        attackTimeMod = templateEffect.attackTimeMod;
        knockbackMod = templateEffect.knockbackMod;
        speedMod = templateEffect.speedMod;
        jumpSpeedMod = templateEffect.jumpSpeedMod;

        duration = templateEffect.duration;
    }
Ejemplo n.º 6
0
    public void SetSpellEffect(Spell newSpell)
    {
        effect = new SpellEffect (newSpell.effect);
        targetsEnemies = newSpell.targetsEnemies;
        AoE = newSpell.AoE;
        rb.useGravity = newSpell.affectedByGravity;
        radius = newSpell.radius;
        deathTimer = newSpell.lifetime;

        GetComponent<SphereCollider> ().radius = newSpell.size;

        if (transform.Find ("Trail") && transform.Find ("Explosion")) {
            transform.Find ("Trail").GetComponent<ParticleSystem> ().startSize *= newSpell.size;
            transform.Find ("Trail").GetComponent<ParticleSystem> ().startColor = newSpell.col;
            transform.Find ("Explosion").GetComponent<ParticleSystem> ().startColor = newSpell.col;
        }
    }
Ejemplo n.º 7
0
    public override bool EquipEvent(int slotNo)
    {
        if (((slotNo ==7) && (GameWorldController.instance.playerUW.isLefty==true)) || ((slotNo ==8) && (GameWorldController.instance.playerUW.isLefty==false)))//Only on off hand
        {
            UpdateQuality();
            if (objInt().isEnchanted==true)
            {
                int EffectId=GetActualSpellIndex ();
                switch (EffectId)
                {
                case SpellEffect.UW1_Spell_Effect_MinorProtection:
                case SpellEffect.UW1_Spell_Effect_Protection:
                case SpellEffect.UW1_Spell_Effect_AdditionalProtection:
                case SpellEffect.UW1_Spell_Effect_MajorProtection:
                case SpellEffect.UW1_Spell_Effect_GreatProtection:
                case SpellEffect.UW1_Spell_Effect_VeryGreatProtection:
                case SpellEffect.UW1_Spell_Effect_TremendousProtection:
                case SpellEffect.UW1_Spell_Effect_UnsurpassedProtection:
                    ProtectionBonus=EffectId-463;
                    break;
                case SpellEffect.UW1_Spell_Effect_MinorToughness:
                case SpellEffect.UW1_Spell_Effect_Toughness:
                case SpellEffect.UW1_Spell_Effect_AdditionalToughness:
                case SpellEffect.UW1_Spell_Effect_MajorToughness:
                case SpellEffect.UW1_Spell_Effect_GreatToughness:
                case SpellEffect.UW1_Spell_Effect_VeryGreatToughness:
                case SpellEffect.UW1_Spell_Effect_TremendousToughness:
                case SpellEffect.UW1_Spell_Effect_UnsurpassedToughness:
                    ToughnessBonus=EffectId-471;
                    break;

                default:
                    //cast enchantment.
                    SpellEffectApplied = GameWorldController.instance.playerUW.PlayerMagic.CastEnchantment(GameWorldController.instance.playerUW.gameObject,null,GetActualSpellIndex(),Magic.SpellRule_TargetSelf);
                    if (SpellEffectApplied!=null)
                    {
                        SpellEffectApplied.SetPermanent(true);
                    }
                    break;
                }
            }
        }
        return true;
    }
Ejemplo n.º 8
0
    public void AddEffect(SpellEffect newEffect)
    {
        //If you already have the effect, just refresh the timer
        bool hasEffect = false;
        for (int i = 0; i < effects.Count; i++) {
            if (effects [i].Equals (newEffect)) {
                hasEffect = true;
                effects [i].SetDuration (newEffect.duration);
            }
        }
        //If not, add the effect
        if (!hasEffect) {
            effects.Add (newEffect);
        }

        //Do damage regardless
        healthmana.ModHealth (-1 * newEffect.instantDamage);
        //Knockback is applied within the "projectile spell" code
    }
Ejemplo n.º 9
0
        public void DrawCurrentEffects()
        {
            if (CurrentEffect == SpellEffect.MagicShieldUp && !MagicShield)
            {
                MagicShield = true;
                Effects.Add(ShieldEffect = new Effect(Libraries.Magic, 3890, 3, 600, this) { Repeat = true });
                CurrentEffect = SpellEffect.None;
            }

            if (CurrentEffect == SpellEffect.ElementalBarrierUp && !ElementalBarrier)
            {
                ElementalBarrier = true;
                Effects.Add(ElementalBarrierEffect = new Effect(Libraries.Magic3, 1890, 16, 3200, this) { Repeat = true });
                CurrentEffect = SpellEffect.None;
            }

            if (ElementEffect > 0 && !HasElements)
            {
                HasElements = true;
                if (ElementEffect == 4)
                    Effects.Add(new ElementsEffect(Libraries.Magic3, 1660, 10, 10 * 100, this, true, 4, ElementOrbMax));
                else
                {
                    if (ElementEffect >= 1)
                        Effects.Add(new ElementsEffect(Libraries.Magic3, 1630, 10, 10 * 100, this, true, 1, ElementOrbMax));
                    if (ElementEffect >= 2)
                        Effects.Add(new ElementsEffect(Libraries.Magic3, 1640, 10, 10 * 100, this, true, 2, ElementOrbMax));
                    if (ElementEffect == 3)
                        Effects.Add(new ElementsEffect(Libraries.Magic3, 1650, 10, 10 * 100, this, true, 3, ElementOrbMax));
                }
                ElementEffect = 0;
            }
        }
Ejemplo n.º 10
0
 public CorpseExplosionHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 11
0
		public DistractEffectHandler(SpellCast cast, SpellEffect effect) : base(cast, effect)
		{
		}
Ejemplo n.º 12
0
        public override IEnumerator UpdateView(FightStatus fightStatus)
        {
            if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus playerStatus))
            {
                if (playerStatus.TryGetSpell(spellInstanceId, out SpellStatus spellStatus))
                {
                    SpellDefinition definition = spellStatus.definition;
                    if (!(null != definition))
                    {
                        yield break;
                    }
                    yield return(definition.LoadResources());

                    ICastTargetDefinition castTarget        = definition.castTarget;
                    CastTargetContext     castTargetContext = castTarget.CreateCastTargetContext(fightStatus, concernedEntity, DynamicValueHolderType.Spell, spellDefId, spellLevel, 0);
                    int count = targets.Count;
                    for (int j = 0; j < count; j++)
                    {
                        castTargetContext.SelectTarget(targets[j].ToTarget(fightStatus));
                    }
                    if (count > 0 && !playerStatus.isLocalPlayer)
                    {
                        CellObject targetedCell = GetTargetedCell(fightStatus, targets[0]);
                        yield return(FightUIRework.ShowPlayingSpell(spellStatus, targetedCell));
                    }
                    List <SpellEffectInstantiationData> spellEffectData = (List <SpellEffectInstantiationData>)definition.spellEffectData;
                    int spellEffectCount = spellEffectData.Count;
                    if (spellEffectCount > 0)
                    {
                        List <IEnumerator> routineList = ListPool <IEnumerator> .Get();

                        int num;
                        for (int i = 0; i < spellEffectCount; i = num)
                        {
                            SpellEffect spellEffect = definition.GetSpellEffect(i);
                            if (!(null == spellEffect))
                            {
                                SpellEffectInstantiationData spellEffectInstantiationData = spellEffectData[i];
                                spellEffectInstantiationData.PreComputeDelayOverDistance(castTargetContext);
                                foreach (Vector2Int item3 in spellEffectInstantiationData.EnumerateInstantiationPositions(castTargetContext))
                                {
                                    IEnumerator item = FightSpellEffectFactory.PlaySpellEffect(spellEffect, item3, spellEffectInstantiationData, castTargetContext);
                                    routineList.Add(item);
                                }
                                foreach (IsoObject item4 in spellEffectInstantiationData.EnumerateInstantiationObjectTargets(castTargetContext))
                                {
                                    IEnumerator item2 = FightSpellEffectFactory.PlaySpellEffect(spellEffect, item4, spellEffectInstantiationData, castTargetContext);
                                    routineList.Add(item2);
                                }
                                yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution(routineList.ToArray()));

                                routineList.Clear();
                            }
                            num = i + 1;
                        }
                        ListPool <IEnumerator> .Release(routineList);
                    }
                    FightSpellEffectFactory.SetupSpellEffectOverrides(definition, fightStatus.fightId, eventId);
                }
                else
                {
                    Log.Error($"Could not find spell with instance id {spellInstanceId} for player with id {concernedEntity}.", 128, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
                }
            }
            else
            {
                Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 133, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\PlaySpellEvent.cs");
            }
        }
Ejemplo n.º 13
0
 public void CastEffect()
 {
     SpellEffect.DynamicInvoke();
 }
Ejemplo n.º 14
0
		public MillingEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 15
0
		public HealEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 16
0
 public DispelMagicHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 17
0
 public SummonWaterElementalHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 18
0
 public PowerDrainEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 19
0
 public HealthLeechEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 20
0
 public WMODamage(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
 public RestoreHealthPercentEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 22
0
 public TriggerSpellEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 23
0
		public CannibalizeEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 24
0
 public ImprovedBlizzardHandler(SpellCast cast, SpellEffect effect) : base(cast, effect)
 {
 }
Ejemplo n.º 25
0
		public ForgetSpecializationEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 26
0
 public DismissPetEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 27
0
		public DismissPetEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 28
0
 public DeathCoilHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 29
0
		public InstantKillEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 30
0
 public FriendFoeTriggerSpellHandler(SpellCast cast, SpellEffect eff, SpellId beneficialSpell, SpellId harmfulSpell)
     : base(cast, eff)
 {
     this.beneficialSpell = beneficialSpell;
     this.harmfulSpell    = harmfulSpell;
 }
Ejemplo n.º 31
0
 public DeathStrikeHealHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 32
0
 public ApplyJudgementEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 33
0
		public WeaponDamageNoSchoolEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 34
0
		public ApplyAuraEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 35
0
 public IceLanceHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 36
0
 public WMORepair(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 37
0
        public override bool OnEquip(Mobile from)
        {
            if ( base.OnEquip(from) )
            {
                if ( SpellEffectOnEquip && from.Alive && !from.Deleted && m_Effect != SpellEffect.None && SpellCharges > 0 )
                {
                    if ( SpellCastEffect.InvokeEffect( m_Effect, from, from ) )
                    {
                        SpellCharges--;
                        if ( SpellCharges <= 0 )
                        {
                            if ( m_Timer != null )
                            {
                                m_Timer.Stop();
                                m_Timer = null;
                            }

                            m_Effect = SpellEffect.None;
                            from.SendAsciiMessage( "This magic item is out of charges." );
                        }
                    }

                    if ( SpellCharges > 0 && SpellCastEffect.IsRepeatingEffect( m_Effect ) )
                    {
                        if ( m_Timer == null )
                            m_Timer = new CheckTimer( this );
                        if ( !m_Timer.Running )
                            m_Timer.Start();
                    }
                }

                return true;
            }
            else
            {
                return false;
            }
        }
Ejemplo n.º 38
0
 public ColdSnapHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 39
0
 public ClearQuestEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 40
0
    public override void UpdateObject()
    {
        SpellEffect item = obj as SpellEffect;

        gameObject.SetActive(item != null);
    }
Ejemplo n.º 41
0
 public WMODamage(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
 public CreateManaGemEffectHandler(SpellCast cast, SpellEffect effect) : base(cast, effect)
 {
 }
Ejemplo n.º 43
0
		public UnusedEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 44
0
 public ScriptEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 45
0
		public ProspectingEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 46
0
 public WeaponEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 47
0
        public void Load(S.ObjectPlayer info)
        {
            Name = info.Name;
            NameColour = info.NameColour;
            GuildName = info.GuildName;
            GuildRankName = info.GuildRankName;
            Class = info.Class;
            Gender = info.Gender;
            Level = info.Level;

            CurrentLocation = info.Location;
            MapLocation = info.Location;
            GameScene.Scene.MapControl.AddObject(this);

            Direction = info.Direction;
            Hair = info.Hair;

            Weapon = info.Weapon;
            Armour = info.Armour;
            Light = info.Light;

            Poison = info.Poison;

            Dead = info.Dead;
            Hidden = info.Hidden;

            WingEffect = info.WingEffect;
            CurrentEffect = info.Effect;

            MountType = info.MountType;
            RidingMount = info.RidingMount;

            Fishing = info.Fishing;

            TransformType = info.TransformType;

            SetLibraries();

            if (Dead) ActionFeed.Add(new QueuedAction { Action = MirAction.Dead, Direction = Direction, Location = CurrentLocation });
            if (info.Extra) Effects.Add(new Effect(Libraries.Magic2, 670, 10, 800, this));

            ElementEffect = (int)info.ElementOrbEffect;
            ElementsLevel = (int)info.ElementOrbLvl;
            ElementOrbMax = (int)info.ElementOrbMax;

            Buffs = info.Buffs;

            LevelEffects = info.LevelEffects;

            ProcessBuffs();

            SetAction();

            SetEffects();
        }
Ejemplo n.º 48
0
 private void OnWordActivation(string word, SpellEffect SpellEffect)
 {
 }
Ejemplo n.º 49
0
		public SummonObjectEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 50
0
 public BindEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 51
0
		public AddExtraAttacksEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 52
0
 public VideoEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 53
0
		public DisenchantEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 54
0
 public EnchantItemEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 55
0
		public StealBeneficialBuffEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 56
0
        public override void UpdateLifeRegen()
        {/*
          * if (Spellsmith.instance.abilityInterface.CurrentState == null)
          * {
          *     if (player.HeldItem.modItem is SpellBlaster)
          *     {
          *         Spellsmith.instance.ShowAbilityUI();
          *     }
          * }
          * else if (!(player.HeldItem.modItem is SpellBlaster))
          * {
          *     Spellsmith.instance.HideAbilityUI();
          * }
          */
            if (activeBlaster != null)
            {
                for (int i = 0; i < activeEffects.Count; i++)
                {
                    if (i < activeEffects.Count)
                    {
                        SpellEffect effect = activeEffects[i];
                        Main.NewText(effect);
                        if (effect.OnCooldown)
                        {
                            bool success = effect.ReduceCooldown();
                            if (success)
                            {
                                activeEffects.Remove(effect);
                            }
                        }
                        else if (effect.CanRunSpell(player, activeBlaster))
                        {
                            Vector2 velocity     = Vector2.Normalize(Main.MouseWorld - player.Center) * activeBlaster.shootSpeed;
                            Vector2 castPosition = player.Center + (Vector2.Normalize(Main.MouseWorld - player.Center) * (activeBlaster.width + 12));

                            switch (effect.Style)
                            {
                            case SpellStyle.Default:
                            {
                                RunSpell(effect, velocity, castPosition);
                                activeEffects.RemoveAt(i);
                                break;
                            }

                            case SpellStyle.HoldRelease:
                            {
                                effect.Charge(player);
                                effect.DoChargeVisuals(player, castPosition, activeBlaster);
                                if (!player.channel)
                                {
                                    RunSpell(effect, velocity, castPosition);
                                }
                                break;
                            }

                            case SpellStyle.Charge:
                            {
                                effect.DoChargeVisuals(player, castPosition, activeBlaster);
                                bool success = effect.Charge(player);
                                if (success || !player.channel)
                                {
                                    RunSpell(effect, velocity, castPosition);
                                }
                                break;
                            }

                            case SpellStyle.ChargeRelease:
                            {
                                effect.DoChargeVisuals(player, castPosition, activeBlaster);
                                effect.Charge(player);
                                if (!player.channel)
                                {
                                    RunSpell(effect, velocity, castPosition);
                                }
                                break;
                            }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 57
0
		public SkillStepEffectHandler(SpellCast cast, SpellEffect effect)
			: base(cast, effect)
		{
		}
Ejemplo n.º 58
0
 public DisenchantEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 59
0
 public EnchantItemTemporaryEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }
Ejemplo n.º 60
0
 public MillingEffectHandler(SpellCast cast, SpellEffect effect)
     : base(cast, effect)
 {
 }