Exemplo n.º 1
0
        public void Increment(CaracId carac, int modification)
        {
            if (modification != 0)
            {
                switch (carac)
                {
                case CaracId.ActionPoints:
                    m_actionPoint += modification;
                    break;

                case CaracId.FirePoints:
                    m_fire += modification;
                    break;

                case CaracId.WaterPoints:
                    m_water += modification;
                    break;

                case CaracId.EarthPoints:
                    m_earth += modification;
                    break;

                case CaracId.AirPoints:
                    m_air += modification;
                    break;

                case CaracId.ReservePoints:
                    m_reserve += modification;
                    break;

                default:
                    throw new ArgumentOutOfRangeException("carac", carac, null);
                }
            }
        }
Exemplo n.º 2
0
 public override void PopulateFromJson(JObject jsonObject)
 {
     base.PopulateFromJson(jsonObject);
     m_selector = ISingleEntitySelectorUtils.FromJsonProperty(jsonObject, "selector");
     m_carac    = (CaracId)Serialization.JsonTokenValue <int>(jsonObject, "carac", 3);
     m_value    = ValueFilter.FromJsonProperty(jsonObject, "value");
 }
 public static bool TryGetFloatingCounterEffect(CaracId counterId, PropertyId?propertyId, out FloatingCounterEffect floatingEffectCounter)
 {
     if (counterId == CaracId.FloatingCounterSight && propertyId.HasValue)
     {
         return(s_sightEffectCache.TryGetValue(propertyId.Value, out floatingEffectCounter));
     }
     return(s_floatingCounterEffectCache.TryGetValue(counterId, out floatingEffectCounter));
 }
 public override void UpdateModifications(ref GaugesModification modifications, PlayerStatus player, DynamicValueContext context)
 {
     for (int i = 0; i < elements.Count; i++)
     {
         CaracId carac = elements[i];
         modifications.Increment(carac, -player.GetCarac(carac));
     }
 }
Exemplo n.º 5
0
 public int GetCarac(CaracId carac, int defaultValue = 0)
 {
     if (m_caracs.TryGetValue(carac, out int value))
     {
         return(value);
     }
     return(defaultValue);
 }
Exemplo n.º 6
0
 void Awake()
 {
     PkB = GameObject.FindGameObjectWithTag("DataBase").GetComponent<PkBase>();
     Mov = GameObject.FindGameObjectWithTag("DataBase").GetComponent<Mov>();
     Hab = GameObject.FindGameObjectWithTag("DataBase").GetComponent<Habilidad>();
     CId1 = GameObject.FindGameObjectWithTag("Pk1").GetComponent<CaracId>();
     CId2 = GameObject.FindGameObjectWithTag("Pk2").GetComponent<CaracId>();
 }
Exemplo n.º 7
0
 public void Initialize(GaugeItemUI ui, CaracId element)
 {
     ((Dictionary <CaracId, Sprite>)m_gaugeSprites).TryGetValue(element, out Sprite value);
     if (null == value)
     {
         Log.Error($"No sprite assigned to element {element}", 241, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\UI\\Fight\\Gauges\\FightUIFactory.cs");
     }
     ui.SetSprite(value);
 }
Exemplo n.º 8
0
 public override void PopulateFromJson(JObject jsonObject)
 {
     base.PopulateFromJson(jsonObject);
     m_counterType           = (CaracId)Serialization.JsonTokenValue <int>(jsonObject, "counterType", 20);
     m_modifier              = (ValueModifier)Serialization.JsonTokenValue <int>(jsonObject, "modifier", 1);
     m_value                 = DynamicValue.FromJsonProperty(jsonObject, "value");
     m_source                = ISingleEntitySelectorUtils.FromJsonProperty(jsonObject, "source");
     m_canAddWithoutPriorSet = Serialization.JsonTokenValue <bool>(jsonObject, "canAddWithoutPriorSet", false);
     m_maximumValue          = Serialization.JsonTokenValue <int?>(jsonObject, "maximumValue", (int?)null);
 }
Exemplo n.º 9
0
 public override IEnumerator UpdateView(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out IEntityWithBoardPresence entityStatus))
     {
         IObjectWithCounterEffects objectWithCounterEffects;
         IObjectWithCounterEffects isoObject = objectWithCounterEffects = (entityStatus.view as IObjectWithCounterEffects);
         if (objectWithCounterEffects != null)
         {
             if (counterReplaced.HasValue)
             {
                 yield return(isoObject.RemoveFloatingCounterEffect());
             }
             CaracId floatingCounterType = (CaracId)this.floatingCounterType;
             if (!FightSpellEffectFactory.TryGetFloatingCounterEffect(floatingCounterType, (PropertyId?)sightProperty, out FloatingCounterEffect effect))
             {
                 yield break;
             }
             if (null != effect)
             {
                 if (valueBefore == 0 || counterReplaced.HasValue)
                 {
                     yield return(isoObject.InitializeFloatingCounterEffect(effect, valueAfter));
                 }
                 else
                 {
                     FloatingCounterFeedback currentFloatingCounterFeedback = isoObject.GetCurrentFloatingCounterFeedback();
                     currentFloatingCounterFeedback.ChangeVisual(effect);
                     yield return(currentFloatingCounterFeedback.SetCount(valueAfter));
                 }
                 if (parentEventId.HasValue)
                 {
                     FightSpellEffectFactory.SetupSpellEffectOverrides(effect, fightStatus.fightId, parentEventId.Value);
                 }
             }
             else
             {
                 Log.Error(string.Format("No prefab defined for {0} {1}.", "FloatingCounterEffect", floatingCounterType), 68, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloatingCounterValueChangedEvent.cs");
             }
         }
         else
         {
             Log.Error(FightEventErrors.EntityHasIncompatibleView <IObjectWithCounterEffects>(entityStatus), 74, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloatingCounterValueChangedEvent.cs");
         }
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <IEntityWithBoardPresence>(concernedEntity), 79, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloatingCounterValueChangedEvent.cs");
     }
 }
Exemplo n.º 10
0
            public override int Compare(CompanionData x, CompanionData y)
            {
                if (x == y)
                {
                    return(0);
                }
                if (x == null)
                {
                    return(1);
                }
                if (y == null)
                {
                    return(-1);
                }
                CaracId caracId  = CaracId.Armor;
                int     value    = int.MaxValue;
                CaracId caracId2 = CaracId.Armor;
                int     value2   = int.MaxValue;

                foreach (Cost item in x.definition.cost)
                {
                    ElementPointsCost elementPointsCost = item as ElementPointsCost;
                    if (elementPointsCost != null)
                    {
                        caracId = elementPointsCost.element;
                        elementPointsCost.value.GetValue(null, out value);
                        break;
                    }
                }
                foreach (Cost item2 in y.definition.cost)
                {
                    ElementPointsCost elementPointsCost2 = item2 as ElementPointsCost;
                    if (elementPointsCost2 != null)
                    {
                        caracId2 = elementPointsCost2.element;
                        elementPointsCost2.value.GetValue(null, out value2);
                        break;
                    }
                }
                if (CaracId.Armor != caracId && caracId2 != CaracId.Armor)
                {
                    if (caracId != caracId2)
                    {
                        return(caracId - caracId2);
                    }
                    return(value - value2);
                }
                return(x.definition.get_id() - y.definition.get_id());
            }
Exemplo n.º 11
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out IEntity entityStatus))
     {
         if (counterReplaced.HasValue)
         {
             entityStatus.SetCarac((CaracId)counterReplaced.Value, 0);
         }
         CaracId floatingCounterType = (CaracId)this.floatingCounterType;
         entityStatus.SetCarac(floatingCounterType, valueAfter);
     }
     else
     {
         Log.Error(FightEventErrors.EntityNotFound <IEntity>(concernedEntity), 27, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\FloatingCounterValueChangedEvent.cs");
     }
 }
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(concernedEntity, out PlayerStatus entityStatus))
     {
         CaracId element = (CaracId)this.element;
         if (entityStatus.GetCarac(element) != valueBefore)
         {
             Log.Warning($"The previous element points value ({entityStatus.GetCarac(element)}) for player with id {concernedEntity} doesn't match the value in the event ({valueBefore}).", 20, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ElementPointsChangedEvent.cs");
         }
         entityStatus.SetCarac(element, valueAfter);
         AbstractPlayerUIRework view = entityStatus.view;
         if (null != view)
         {
             view.RefreshAvailableCompanions();
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(concernedEntity), 33, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\ElementPointsChangedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.ElementPointsChanged);
 }
 public override void PopulateFromJson(JObject jsonObject)
 {
     base.PopulateFromJson(jsonObject);
     m_entity = IEntityFilterUtils.FromJsonProperty(jsonObject, "entity");
     m_carac  = (CaracId)Serialization.JsonTokenValue <int>(jsonObject, "carac", 0);
 }
Exemplo n.º 14
0
 public void PopulateFromJson(JObject jsonObject)
 {
     m_element = (CaracId)Serialization.JsonTokenValue <int>(jsonObject, "element", 0);
     m_value   = DynamicValue.FromJsonProperty(jsonObject, "value");
 }
 public void PopulateFromJson(JObject jsonObject)
 {
     m_caracId = (CaracId)Serialization.JsonTokenValue <int>(jsonObject, "caracId", 6);
 }
Exemplo n.º 16
0
        private static void PreviewElementaryPoints(LocalPlayerUIRework localPlayerUI, CaracId element, int value, ValueModifier modifier)
        {
            switch (element)
            {
            case CaracId.FirePoints:
                localPlayerUI.ShowPreviewFire(value, modifier);
                break;

            case CaracId.WaterPoints:
                localPlayerUI.ShowPreviewWater(value, modifier);
                break;

            case CaracId.EarthPoints:
                localPlayerUI.ShowPreviewEarth(value, modifier);
                break;

            case CaracId.AirPoints:
                localPlayerUI.ShowPreviewAir(value, modifier);
                break;

            default:
                throw new ArgumentOutOfRangeException("element", element, null);
            }
        }
Exemplo n.º 17
0
 public override void PopulateFromJson(JObject jsonObject)
 {
     base.PopulateFromJson(jsonObject);
     m_counterType    = (CaracId)Serialization.JsonTokenValue <int>(jsonObject, "counterType", 20);
     m_entitySelector = ISingleEntitySelectorUtils.FromJsonProperty(jsonObject, "entitySelector");
 }
Exemplo n.º 18
0
 public void SetCarac(CaracId carac, int value)
 {
     m_caracs[carac] = value;
 }
Exemplo n.º 19
0
 public override void PopulateFromJson(JObject jsonObject)
 {
     base.PopulateFromJson(jsonObject);
     m_player      = OwnerFilter.FromJsonProperty(jsonObject, "player");
     m_elementType = (CaracId)Serialization.JsonTokenValue <int>(jsonObject, "elementType", 12);
 }
 public void PopulateFromJson(JObject jsonObject)
 {
     m_superlative = (Superlative)Serialization.JsonTokenValue <int>(jsonObject, "superlative", 1);
     m_carac       = (CaracId)Serialization.JsonTokenValue <int>(jsonObject, "carac", 1);
 }