示例#1
0
    public override bool RunScript(RandEventArg argument)
    {
        ErrorHandler.Parse(
            SkillDetails.AddSkillEffectByResource(OwnerAttribute, mOwner, skillEffectID),
            "SkillEffectGenerator: failed to add skill effect"
            );

        return(true);
    }
示例#2
0
    public override bool RunScript(RandEventArg argument)
    {
        ErrorHandler.Parse(
            SkillDetails.CreateCreationAround(createrAttr, creationId, mOwner.GetPosition(), mOwner.GetDirection()),
            "failed to run script SS_DeathCreation"
            );

        return(true);
    }
示例#3
0
    /// <summary>
    /// 当triggerType指定的事件发生时, 检查randEventContainer列表, 触发随机事件.
    /// </summary>
    /// <param name="theOther">触发事件的单位.</param>
    /// <param name="eventOwner">为随机事件的拥有者.</param>
    /// <remarks>randevent的技能效果不由任何技能发起(只可以得知该随机事件是如何被注册的)</remarks>
    public static void ApplyRandEvent(
        BattleUnit theOther,
        BattleUnit eventOwner,
        BattleUnitRandEventContainer randEventContainer,
        RandEventTriggerType triggerType,
        RandEventArg triggerArg
        )
    {
        List <uint> buffNeed2Remove = new List <uint>();
        List <BattleUnitRandEvent> typedContainer = randEventContainer[triggerType];

        //LinkedListNode<BattleUnitRandEvent> currentNode = typedContainer.First;

        // SkillScript可能产生新的randevent加入容器中, 导致容器改变, 因此不能通过foreach遍历.
        // 获取当前指定类型的容器中的元素个数, 只遍历当前的元素(新的randevent通过AddLast加入到容器中, 因此不会被遍历到).

        for (int i = typedContainer.Count - 1; i >= 0; --i)
        {
            BattleUnitRandEvent randEvent = typedContainer[i];

            SkillRandEventTableItem randEventRes = randEvent.randEventResource;

            // 检查CD.
            if (randEvent.cdMilliseconds != 0)
            {
                continue;
            }

            // 检查概率.
            if (!SkillUtilities.Random100(randEventRes.probability))
            {
                continue;
            }

            SkillClientBehaviour.AddEffect2Object(eventOwner, randEventRes._3DEffectID, randEventRes._3DEffectBindpoint);

            if (randEvent.mScript != null && !randEvent.mScript.RunScript(triggerArg))
            {
                buffNeed2Remove.Add((uint)randEvent.fromBuffRes.resID);
            }

            randEvent.cdMilliseconds = randEventRes.cdMilliseconds;
        }

//             for (int count = typedContainer.Count; count != 0; --count, currentNode = currentNode.Next)
//             {
//
//             }

        for (int i = 0; i < buffNeed2Remove.Count; ++i)
        {
            eventOwner.RemoveSkillBuffByResID(buffNeed2Remove[i]);
        }
/*            foreach (uint id in buffNeed2Remove)*/
    }
示例#4
0
    public override bool RunScript(RandEventArg argument)
    {
        ErrorHandler.Parse(
            SkillDetails.SelectTargetAndAddSkillEffect(OwnerAttribute,
                                                       mOwner.GetPosition(),
                                                       mOwner.GetDirection(), targetSelection, skillEffect),
            "failed to run script SS_CorpseExplosion"
            );

        return(true);
    }
示例#5
0
    public override bool RunScript(RandEventArg argument)
    {
        if (leftCount == 0)
        {
            return(ErrorHandler.Parse(ErrorCode.LogicError, "invalid left count for skill script SS_Refraction"));
        }

        // 完全抵挡这次伤害.
        BeAttackedEventArg eventArg = argument as BeAttackedEventArg;

        eventArg.PositiveDamage = 0;
        return(--leftCount != 0);
    }
示例#6
0
    public override bool RunScript(RandEventArg argument)
    {
        AtkOthersEventArg atkOthersArg = argument as AtkOthersEventArg;

        ErrorHandler.Parse(
            SkillDetails.AddSkillEffectByResource(OwnerAttribute,
                                                  atkOthersArg.Target,
                                                  skillEffectID),
            "failed to run script SS_SkillEffectPlacer"
            );

        return(true);
    }
示例#7
0
    public override bool RunScript(RandEventArg argument)
    {
        AtkOthersEventArg atkEventArg = argument as AtkOthersEventArg;
        int hpRegenerated             = (int)(atkEventArg.FireDamage * percent);

        if (hpRegenerated != 0)
        {
            mOwner.AddDamage(new DamageInfo()
            {
                Value = hpRegenerated
            }, OwnerAttribute);
        }

        return(true);
    }
示例#8
0
    public override bool RunScript(RandEventArg argument)
    {
        FatalStrikeEventArg fatalStrikeArg = argument as FatalStrikeEventArg;

        fatalStrikeArg.BlockThisDamage = true;

        int hpMax   = mOwner.GetPropertyValue((int)PropertyTypeEnum.PropertyTypeMaxHP);
        int manaMax = mOwner.GetPropertyValue((int)PropertyTypeEnum.PropertyTypeMaxMana);

        // 回满血量和魔量.
        mOwner.ModifyPropertyValue((int)PropertyTypeEnum.PropertyTypeHP, hpMax);
        mOwner.ModifyPropertyValue((int)PropertyTypeEnum.PropertyTypeMana, manaMax);

        // 一次重生之后, 移除buff.
        return(false);
    }
示例#9
0
    public override bool RunScript(RandEventArg argument)
    {
        BeAttackedEventArg beAtkArg = argument as BeAttackedEventArg;

        // 新的伤害值不大于当前能抵挡的伤害, 更新当前可以抵挡的伤害, 并清空新的伤害.
        if (remaining >= beAtkArg.PositiveDamage)
        {
            remaining -= beAtkArg.PositiveDamage;
            beAtkArg.PositiveDamage = 0;
        }
        else
        {               // 吸收足够的伤害值.
            beAtkArg.PositiveDamage -= remaining;
            remaining = 0;
        }

        mOwner.SetShieldUIProgress(((float)remaining) / capacity);

        // 吸收足够的伤害值之后, 该效果消失.
        return(remaining > 0);
    }
示例#10
0
    public override bool RunScript(RandEventArg argument)
    {
        StartRegularSkillEventArg regularSkillArg = argument as StartRegularSkillEventArg;
        Role            role        = mOwner as Role;
        int             weaponID    = role.GetMainWeaponID();
        WeaponTableItem weaponTable = (weaponID >= 0)
                        ? DataManager.WeaponTable[weaponID] as WeaponTableItem : null;

        //
        if (weaponTable == null)
        {
            return(ErrorHandler.Parse(ErrorCode.ConfigError, "武器ID[" + weaponID + "]不存在weapon.txt中, 加强buff将被移除"));
        }

        if (weaponTable.skill_2 < 0)
        {
            return(ErrorHandler.Parse(ErrorCode.ConfigError, "武器[" + weaponID + "]没有强化技能, 加强buff将被移除"));
        }

        regularSkillArg.SkillResID = (uint)weaponTable.skill_2;

        return(true);
    }
示例#11
0
 /// <summary>
 /// 检测并在当前角色应用随机事件.
 /// </summary>
 /// <param name="attackerAttr">触发该事件的角色的属性</param>
 /// <param name="skillCommonResID">触发该事件的技能ID</param>
 /// <param name="type">事件触发类型</param>
 public void ApplyRandEvent(BattleUnit theOther, RandEventTriggerType type, RandEventArg argument)
 {
     SkillDetails.ApplyRandEvent(theOther, this, mRandEventContainer, type, argument);
 }
示例#12
0
 /// <summary>
 /// 随机事件被触发, 执行该随机事件脚本.
 /// </summary>
 /// <returns>如果返回false, 该脚本所来源的BUFF需要被移除.</returns>
 public abstract bool RunScript(RandEventArg argument);