Exemplo n.º 1
0
        protected bool CheckAttrChangeCondition(Condition conditionData, ConditionMessage message)
        {
            if (!(message is AttrChangeConditionMessage))
            {
                return(false);
            }
            if (!this.CheckConditionExtraInspection(conditionData, null, null))
            {
                return(false);
            }
            AttrChangeConditionMessage attrChangeConditionMessage = message as AttrChangeConditionMessage;
            AttrType attrType;

            switch (conditionData.attr)
            {
            case 1:
                attrType = AttrType.Hp;
                break;

            case 2:
                attrType = AttrType.ActPoint;
                break;

            case 3:
                attrType = AttrType.Vp;
                break;

            default:
                return(false);
            }
            return(attrType == attrChangeConditionMessage.attrType && (!this.CheckConditionAttrDetail(conditionData.percentage, attrChangeConditionMessage.oldPercentage * 100.0) || !this.CheckConditionAttrDetail(conditionData.@base, (double)attrChangeConditionMessage.oldValue)) && this.CheckConditionAttrDetail(conditionData.percentage, attrChangeConditionMessage.curPercentage * 100.0) && this.CheckConditionAttrDetail(conditionData.@base, (double)attrChangeConditionMessage.curValue));
        }
Exemplo n.º 2
0
    public static void Announce(EntityParent announcer, AttrType attrType, double oldPercentage, double curPercentage, long oldValue, long curValue)
    {
        AttrChangeConditionMessage attrChangeConditionMessage = new AttrChangeConditionMessage();

        attrChangeConditionMessage.type          = AttrChangeAnnouncer.type;
        attrChangeConditionMessage.announcer     = announcer;
        attrChangeConditionMessage.attrType      = attrType;
        attrChangeConditionMessage.oldPercentage = oldPercentage;
        attrChangeConditionMessage.curPercentage = curPercentage;
        attrChangeConditionMessage.oldValue      = oldValue;
        attrChangeConditionMessage.curValue      = curValue;
        EventDispatcher.Broadcast <ConditionMessage>(ConditionManagerEvent.CheckCondition, attrChangeConditionMessage);
    }