protected override void OnTick()
            {
                if (m_Attacker.HarmfulCheck(m_Defender))
                {
                    double damage;

                    if (Core.AOS)
                    {
                        damage = m_Spell.GetNewAosDamage(40, 1, 5, m_Defender);
                    }
                    else
                    {
                        damage = SpellController.GetDamage(SpellController.ExplosionDamage);

                        if (m_Spell.CheckResisted(m_Target))
                        {
                            damage *= 0.75;

                            m_Target.SendLocalizedMessage(501783);                               // You feel yourself resisting magical energy.
                        }

                        damage *= m_Spell.GetDamageScalar(m_Target);
                    }

                    m_Target.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
                    m_Target.PlaySound(0x307);

                    SpellHelper.Damage(m_Spell, m_Target, damage, 0, 100, 0, 0, 0);

                    if (m_Spell != null)
                    {
                        m_Spell.RemoveDelayedDamageContext(m_Attacker);
                    }
                }
            }
 void OnSpellSwitched(SpellController newSpell)
 {
     if (newSpell != null)
     {
         newSpell.ShowSpell(true);
     }
 }
示例#3
0
    void Start()
    {
        spellController = GameObject.FindGameObjectWithTag("Player").GetComponent <SpellController>();
        heatBarImage    = GetComponentsInChildren <Image>()[1];

        spellController.OnHeatChange = OnHeatChange;
    }
示例#4
0
 new private void Start()
 {
     count           = spellCount;
     Player          = GameObject.Find("Player");
     animation       = Player.GetComponent <Animator>();
     spellController = Player.GetComponent <SpellController>();
 }
        public async Task CallFilterSpellsAsync_WhenCalled()
        {
            // Arrange
            Mock <ISpellService> spellServiceMock = new Mock <ISpellService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            string validSortOrder  = string.Empty;
            string validFilter     = string.Empty;
            int    validPageNumber = 1;
            int    validPageSize   = 10;

            IPagedList <Spell> spells = new PagedList <Spell>(new List <Spell>().AsQueryable(), validPageNumber, validPageSize);

            spellServiceMock.Setup(mock => mock.FilterSpellsAsync(validSortOrder, validFilter, validPageNumber, validPageSize))
            .Returns(Task.FromResult(spells));

            SpellController SUT = new SpellController(
                spellServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act
            await SUT.Filter(validSortOrder, validFilter, validPageNumber, validPageSize);

            // Assert
            spellServiceMock
            .Verify(mock => mock.FilterSpellsAsync(validSortOrder, validFilter, validPageNumber, validPageSize),
                    Times.Once);
        }
        public async Task CallFindAsync_WhenCalled()
        {
            // Arrange
            Mock <ISpellService> spellServiceMock = new Mock <ISpellService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            string validId = string.Empty;

            Spell validSpellResult = new Spell();

            spellServiceMock.Setup(mock => mock.FindAsync(validId))
            .Returns(Task.FromResult(validSpellResult));

            SpellController SUT = new SpellController(
                spellServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act
            await SUT.Details(validId);

            // Assert
            spellServiceMock.Verify(mock => mock.FindAsync(validId), Times.Once);
        }
        public async Task ReturnCorrectViewModel_WhenCalled()
        {
            // Arrange
            Mock <ISpellService> spellServiceMock = new Mock <ISpellService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            string validSortOrder  = string.Empty;
            string validFilter     = string.Empty;
            int    validPageNumber = 1;
            int    validPageSize   = 10;

            IPagedList <Spell> spells = new PagedList <Spell>(new List <Spell>().AsQueryable(), validPageNumber, validPageSize);

            spellServiceMock.Setup(mock => mock.FilterSpellsAsync(validSortOrder, validFilter, validPageNumber, validPageSize))
            .Returns(Task.FromResult(spells));

            SpellController SUT = new SpellController(
                spellServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act
            var result = await SUT.Filter(validSortOrder, validFilter, validPageNumber, validPageSize) as PartialViewResult;

            // Assert
            Assert.IsInstanceOfType(result.Model, typeof(TableViewModel <SpellViewModel>));
        }
        public async Task ThrowApplicationException_WhenSpellsIsNull()
        {
            // Arrange
            Mock <ISpellService> spellServiceMock = new Mock <ISpellService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            string validSortOrder  = string.Empty;
            string validFilter     = string.Empty;
            int    validPageNumber = 1;
            int    validPageSize   = 10;

            IPagedList <Spell> spells = null;

            spellServiceMock.Setup(mock => mock.FilterSpellsAsync(validSortOrder, validFilter, validPageNumber, validPageSize))
            .Returns(Task.FromResult(spells));

            SpellController SUT = new SpellController(
                spellServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act & Assert
            await Assert.ThrowsExceptionAsync <ApplicationException>(() =>
                                                                     SUT.Download(validSortOrder, validFilter, validPageNumber, validPageSize));
        }
 // Start is called before the first frame update
 void Start()
 {
     cam             = Camera.main;
     motor           = GetComponent <PlayerMotor>();
     spellController = GetComponent <SpellController>();
     stats           = GetComponent <PlayerStats>();
 }
	// Use this for initialization
	void Start () {
        rb = gameObject.GetComponent<Rigidbody2D>();
        moveCharacter = gameObject.GetComponent<MoveCharacter>();
        weaponController = gameObject.GetComponent<WeaponController>();
        spellController = gameObject.GetComponent<SpellController>();
        gameObject.GetComponent<Health>().OnDeath += onDeath;
	}
示例#11
0
    public void Bind()
    {
        if (PlayerController.instance == null)
        {
            return;
        }
        CharacterController playerInfo   = PlayerController.instance?.characterController;
        SpellController     playerSpell  = PlayerController.instance?.GetComponent <SpellController>();
        WeaponController    playerWeapon = PlayerController.instance?.GetComponent <WeaponController>();

        if (powerBar != null)
        {
            powerBar.bindPowerBar(playerInfo?.energy);
        }
        if (healthBar != null)
        {
            healthBar.bindHealthBar(playerInfo?.health);
        }

        if (spellUI != null && playerSpell != null)
        {
            spellUI.bindSpellSlot(playerSpell);
        }

        if (weaponUI != null && playerWeapon != null)
        {
            weaponUI.bindWeaponSlot(playerWeapon);
        }
    }
        public async Task ReturnCorrectViewModel_WhenCalled()
        {
            // Arrange
            Mock <ISpellService> spellServiceMock = new Mock <ISpellService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            string validId = string.Empty;

            Spell validSpellResult = new Spell();

            spellServiceMock.Setup(mock => mock.FindAsync(validId))
            .Returns(Task.FromResult(validSpellResult));

            SpellController SUT = new SpellController(
                spellServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act
            var result = await SUT.Details(validId) as ViewResult;

            // Assert
            Assert.IsInstanceOfType(result.Model, typeof(SpellDetailsViewModel));
        }
示例#13
0
 // Switches to the given Spell index in Spell slots if the new index is a valid Spell that is different from our current one
 public void SwitchToSpellIndex(SpellController SpellPrefab, int newSpellIndex)
 {
     if (newSpellIndex <= m_SpellSlots.Length && newSpellIndex >= 0)
     {
         SpellController SpellInstance = ReadySpell(SpellPrefab);
         m_SpellSlots[newSpellIndex] = SpellInstance;
     }
 }
示例#14
0
 private void OnSpellControllerFinishedTaskList(SpellController spellController)
 {
     spellController.DetachPowerTaskList();
     if (this.m_currentTaskList != null)
     {
         this.DoCurrentTaskList();
     }
 }
示例#15
0
 public void Start()
 {
     _helper = new Mock <IApiHelper>();
     _helper.Setup(x => x.GetSpellData(It.IsAny <string>())).ReturnsAsync(new Models.Spell());
     _classController = new ClassController(_helper.Object);
     _spellController = new SpellController(_helper.Object);
     _homeController  = new HomeController();
 }
示例#16
0
	// Use this for initialization
	void Start ()
	{
		gameController = GameController.current;
		sfx = SoundFX.current;
		this.spell = "";
		eventController = this.gameObject.GetComponent<EventController> ();
		spellController = this.gameObject.GetComponent<SpellController> ();
	}
        public void Spells()
        {
            SpellController controller = new SpellController();

            var x = controller.Details(1);

            Assert.IsNotNull(x);
        }
示例#18
0
 private void Awake()
 {
     rend       = Skin.GetComponent <Renderer>();
     curMats    = Skin.GetComponent <Renderer>().materials;
     curColor   = rend.material.color;
     controller = GameObject.FindGameObjectWithTag("Player").GetComponent <SpellController>();
     body       = GetComponent <Rigidbody>();
 }
示例#19
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckHSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                SpellHelper.CheckReflect((int)this.Circle, Caster, ref m);

                double damage;

                if (Core.AOS)
                {
                    damage = GetNewAosDamage(17, 1, 5, m);
                }
                else
                {
                    damage = SpellController.GetDamage(SpellController.HarmDamage);

                    if (CheckResisted(m))
                    {
                        damage *= 0.75;

                        m.SendLocalizedMessage(501783);                           // You feel yourself resisting magical energy.
                    }

                    damage *= GetDamageScalar(m);
                }

                if (!m.InRange(Caster, 2))
                {
                    damage *= 0.25;                     // 1/4 damage at > 2 tile range
                }
                else if (!m.InRange(Caster, 1))
                {
                    damage *= 0.50;                     // 1/2 damage at 2 tile range
                }
                if (Core.AOS)
                {
                    m.FixedParticles(0x374A, 10, 30, 5013, 1153, 2, EffectLayer.Waist);
                    m.PlaySound(0x0FC);
                }
                else
                {
                    m.FixedParticles(0x374A, 10, 15, 5013, EffectLayer.Waist);
                    m.PlaySound(0x1F1);
                }

                SpellHelper.Damage(this, m, damage, 0, 0, 100, 0, 0);
            }

            FinishSequence();
        }
        public async Task CallFilterSpellsAsync_WhenCalled()
        {
            // Arrange
            Mock <ISpellService> spellServiceMock = new Mock <ISpellService>();
            Mock <IPDFService>   pDFServiceMock   = new Mock <IPDFService>();
            Mock <IMemoryCache>  memoryCacheMock  = new Mock <IMemoryCache>();

            IList <string> validFileParameters = typeof(SpellDownloadViewModel).GetProperties().Select(p => p.Name.ToString()).ToList();
            string         validCollection     = "spells";

            string validSortOrder  = string.Empty;
            string validFilter     = string.Empty;
            int    validPageNumber = 1;
            int    validPageSize   = 10;

            string validFileName = string.Empty;

            byte[] validFileBytes = new byte[0];

            IPagedList <Spell> spells = new PagedList <Spell>(
                new List <Spell>().AsQueryable(),
                validPageNumber,
                validPageSize);

            IPagedList <SpellDownloadViewModel> spellDownloadViewModels = new PagedList <SpellDownloadViewModel>(
                new List <SpellDownloadViewModel>().AsQueryable(),
                validPageNumber,
                validPageSize);

            spellServiceMock.Setup(mock => mock.FilterSpellsAsync(validSortOrder, validFilter, validPageNumber, validPageSize))
            .Returns(Task.FromResult(spells));

            pDFServiceMock
            .Setup(mock => mock.CreatePDF(spellDownloadViewModels, validFileParameters, validCollection))
            .Returns(validFileName);

            pDFServiceMock
            .Setup(mock => mock.GetFileBytesAsync(validFileName))
            .Returns(Task.FromResult(validFileBytes));

            pDFServiceMock
            .Setup(mock => mock.DeleteFile(validFileName));

            SpellController SUT = new SpellController(
                spellServiceMock.Object,
                pDFServiceMock.Object,
                memoryCacheMock.Object);

            // Act
            await SUT.Download(validSortOrder, validFilter, validPageNumber, validPageSize);

            // Assert
            spellServiceMock.Verify(mock =>
                                    mock.FilterSpellsAsync(validSortOrder, validFilter, validPageNumber, validPageSize),
                                    Times.Once);
        }
    // Use this for initialization
    void Start()
    {
        movPhysics = this.GetComponent<DirectMovementPhysics>();
        spellController = this.GetComponent<SpellController>();
        stats = this.GetComponent<Stats>();

        controlScheme = ControlManager.GetControlScheme(1);
        //Spells = new List<ISpellBase>();
        //Actions = new List<Action>();
    }
示例#22
0
    private void CmdSpawnSpell(string effectName, string spellName)
    {
        GameObject      go = Instantiate(Resources.Load <GameObject>(spellName), SpellSpawn.transform.position, gameObject.transform.rotation);
        SpellController sc = go.GetComponent <SpellController>();

        sc.damage     = 20;
        sc.effectName = effectName;
        NetworkServer.Spawn(go);
        Destroy(go, 5.0f);
    }
示例#23
0
    public float CastableShots(int spellIndex)
    {
        SpellController spell = m_SpellSlots[spellIndex];

        if (spell.CanShoot())
        {
            return(spell.GetCurrentAmmo());
        }
        return(0);
    }
示例#24
0
    // Use this for initialization
    void Start()
    {
        movPhysics      = this.GetComponent <DirectMovementPhysics>();
        spellController = this.GetComponent <SpellController>();
        stats           = this.GetComponent <Stats>();

        controlScheme = ControlManager.GetControlScheme(1);
        //Spells = new List<ISpellBase>();
        //Actions = new List<Action>();
    }
示例#25
0
    void CastSpell()
    {
        spellClone = Instantiate(selectedSpell, transform.position, Quaternion.identity) as GameObject;
        SpellController spellController = spellClone.GetComponent <SpellController>();

        spellController.startPosition  = new Vector3(transform.position.x, transform.position.y, transform.position.z + 0.4f);
        spellController.startDirection = transform.up;

        spellClone.SetActive(true);
    }
示例#26
0
    public bool CastSpell(int spellIndex)
    {
        print(string.Format("casting spell : {0}", spellIndex));
        SpellController spell = m_SpellSlots[spellIndex];

        return(spell.HandleShootInputs(
                   true,   // down
                   true,   // hold
                   true)); //release
    }
示例#27
0
    void CmdShootSpell()
    {
        GameObject      go = Instantiate(spell);
        SpellController sc = go.GetComponent <SpellController>();

        sc.damage             = 20;
        go.transform.position = spellSpawn.transform.position;
        NetworkServer.Spawn(go);
        Destroy(go, 5.0f);
    }
示例#28
0
    private Animator anim;          //!< Animator controller

    /*!
     * Instantiates member values
     */
    void Start()
    {
        anim           = GetComponent <Animator>();
        gamecontroller = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
        //cursor = GameObject.FindGameObjectWithTag("Cursor");
        mainCam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
        spellUI = GameObject.FindGameObjectWithTag("SpellController").GetComponent <SpellController>();
        uic     = GameObject.FindGameObjectWithTag("UIController").GetComponent <UIController>();

        timeHeld = 0.0;
    }
示例#29
0
    void Start()
    {
        agent           = GetComponent <NavMeshAgent>();
        anim            = transform.GetComponentInChildren <Animator>();
        attackspeed     = (1 / hero.attackSpeed);
        rb              = GetComponent <Rigidbody>();
        spellController = GetComponent <SpellController>();
        GameObject go = GameObject.Find("MainCanvas");

        HUD = go.GetComponent <MainHUDScreen>();
    }
 // Switches to the given Spell index in Spell slots if the new index is a valid Spell that is different from our current one
 public void SwitchToSpellIndex(SpellController SpellPrefab, int newSpellIndex)
 {
     if (newSpellIndex <= 4 && newSpellIndex >= 0)
     {
         SpellController SpellInstance = ReadySpell(SpellPrefab);
         m_SpellSlots[newSpellIndex] = SpellInstance;
         if (onSwitchedToSpell != null)
         {
             onSwitchedToSpell.Invoke(SpellInstance);
         }
     }
 }
 private void Awake()
 {
     anim = GameObject.FindGameObjectWithTag("Hand").GetComponent <Animator>();
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#32
0
        public void Target(Mobile m)
        {
            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (m.IsDeadBondedPet)
            {
                Caster.SendLocalizedMessage(1060177);                   // You cannot heal a creature that is already dead!
            }
            else if (m is BaseCreature && ((BaseCreature)m).IsAnimatedDead)
            {
                Caster.SendLocalizedMessage(1061654);                   // You cannot heal that which is not alive.
            }
            else if (m is Golem)
            {
                Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500951);                   // You cannot heal that.
            }
            else if (m.Poisoned || Server.Items.MortalStrike.IsWounded(m))
            {
                Caster.LocalOverheadMessage(MessageType.Regular, 0x22, (Caster == m) ? 1005000 : 1010398);
            }
            else if (CheckBSequence(m))
            {
                SpellHelper.Turn(Caster, m);

                int toHeal;

                if (Core.AOS)
                {
                    toHeal  = Caster.Skills.Magery.Fixed / 120;
                    toHeal += Utility.RandomMinMax(1, 4);

                    if (Core.SE && Caster != m)
                    {
                        toHeal = (int)(toHeal * 1.5);
                    }
                }
                else
                {
                    toHeal  = (int)(Caster.Skills[SkillName.Magery].Value * 0.1);
                    toHeal += SpellController.GetDamage(SpellController.HealDamage);
                }

                m.Heal(toHeal);

                m.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist);
                m.PlaySound(0x1F2);
            }

            FinishSequence();
        }
    public bool HasSpell(SpellController SpellPrefab)
    {
        // Checks if we already have a Spell coming from the specified prefab
        foreach (var w in m_SpellSlots)
        {
            if (w != null && w.sourcePrefab == SpellPrefab.gameObject)
            {
                return(true);
            }
        }

        return(false);
    }