/// <summary>
        /// </summary>
        /// <param name="nanoId">
        /// </param>
        /// <param name="target">
        /// </param>
        /// <returns>
        /// </returns>
        /// <exception cref="NotImplementedException">
        /// </exception>
        public bool CastNano(int nanoId, Identity target)
        {
            // Procedure:
            // 1. Check if nano can be casted (criteria to Use (3))
            // 2. Lock nanocasting ability
            // 3. Wait for cast attack delay
            // 4. Check target's restance to the nano
            // 5. Execute nanos gamefunctions
            // 6. Wait for nano recharge delay
            // 7. Unlock nano casting

            NanoFormula nano   = NanoLoader.NanoList[nanoId];
            int         strain = nano.NanoStrain();

            CastNanoSpellMessageHandler.Default.Send(this.Character, nanoId, target);

            // CharacterAction 107 - Finish nano casting
            int attackDelay = this.Character.CalculateNanoAttackTime(nano);

            Console.WriteLine("Attack-Delay: " + attackDelay);
            if (attackDelay != 1234567890)
            {
                Thread.Sleep(attackDelay * 10);
            }

            // Check here for nanoresist of the target, maybe the 1 in finishnanocasting is kind of did land/didnt land flag
            CharacterActionMessageHandler.Default.FinishNanoCasting(
                this.Character,
                CharacterActionType.FinishNanoCasting,
                Identity.None,
                1,
                nanoId);

            // TODO: Calculate nanocost modifiers etc.
            this.Character.Stats[StatIds.currentnano].Value -= nano.getItemAttribute(407);

            // CharacterAction 98 - Set nano duration
            CharacterActionMessageHandler.Default.SetNanoDuration(
                this.Character,
                target,
                nanoId,
                nano.getItemAttribute(8));

            Thread.Sleep(nano.getItemAttribute(210) * 10); // Recharge Delay
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// </summary>
        /// <param name="nano">
        /// </param>
        /// <returns>
        /// </returns>
        public int CalculateNanoAttackTime(NanoFormula nano)
        {
            // Calculation in 100's of seconds!!

            int aggdef = this.Stats[StatIds.aggdef].Value;

            int aggdefReduction = aggdef - 25;
            int nanoinit        = this.Stats[StatIds.nanoprowessinitiative].Value;

            if (nanoinit > 1200)
            {
                nanoinit = ((nanoinit - 1200) / 3) + 1200;
            }

            int nanoInitreduction = nanoinit >> 1;

            int attackCap = nano.getItemAttribute(523);   // AttackDelayCap

            int attackDelay = nano.getItemAttribute(294); // AttackDelay

            // The Math.Min is safeguard for calculation errors due to uint->int casting of originally negative values
            return(Math.Min(Math.Max(attackDelay - aggdefReduction - nanoInitreduction, attackCap), attackDelay));
        }