protected void RecalculateBasketCountry( BasketCountryModel model, TargetingType targetingType, BroadGlobalActivePortfolio portfolio, ICollection <BgaPortfolioSecurityTargetInfo> result, IDataManager manager, CalculationTicket ticket ) { var baseValue = model.Base.Value(ticket); if (!baseValue.HasValue) { throw new ValidationException(new ErrorIssue("There is no base value defined for the \"" + model.Basket.Country.Name + "\" country (ISO: " + model.Basket.Country.IsoCode + ").")); } var portfolioScaledValue = model.PortfolioScaled.Value(ticket); if (!portfolioScaledValue.HasValue) { throw new ValidationException(new ErrorIssue("There is no portfolio scaled value defined for the \"" + model.Basket.Country.Name + "\" country (ISO: " + model.Basket.Country.IsoCode + ").")); } this.RecalculateSecurityTargets( portfolioScaledValue.Value, model.Basket, targetingType, portfolio, result, manager, ticket ); }
public RootModel( TargetingType targetingType, BroadGlobalActivePortfolio portfolio, TargetingTypeBasketBaseValueChangesetInfo latestTtbbvChangesetInfo, TargetingTypeBasketPortfolioTargetChangesetInfo latestTtbptChangesetInfo, BgaPortfolioSecurityFactorChangesetInfo latestPstoChangesetInfo, BuPortfolioSecurityTargetChangesetInfo latestPstChangesetInfo, GlobeModel globe, CashModel cash, Overlaying.RootModel factors, IExpression <Decimal?> portfolioScaledGrandTotalExpression, IExpression <Decimal?> trueExposureGrandTotal, IExpression <Decimal?> trueActiveGrandTotal, DateTime benchmarkDate, Boolean isUserPermittedToSave ) { this.TargetingType = targetingType; this.Portfolio = portfolio; this.LatestTtbbvChangeset = latestTtbbvChangesetInfo; this.LatestTtbptChangeset = latestTtbptChangesetInfo; this.LatestPstoChangeset = latestPstoChangesetInfo; this.LatestPstChangeset = latestPstChangesetInfo; this.Globe = globe; this.Cash = cash; this.Factors = factors; this.PortfolioScaledGrandTotal = portfolioScaledGrandTotalExpression; this.TrueExposureGrandTotal = trueExposureGrandTotal; this.TrueActiveGrandTotal = trueActiveGrandTotal; this.BenchmarkDate = benchmarkDate; this.IsUserPermittedToSave = isUserPermittedToSave; }
protected void RecalculateTargetingType( TargetingType targetingType, ICollection <BgaPortfolioSecurityTargetInfo> result, IDataManager manager ) { var issues = new List <IValidationIssue>(); foreach (var portfolio in targetingType.BroadGlobalActivePortfolios) { try { this.RecalculatePortfolio( targetingType, portfolio, result, manager ); } catch (ValidationException exception) { issues.Add(exception.Issue); } if (issues.Any(x => x is ErrorIssue)) { var issue = new CompoundValidationIssue( "Unable to recalculate the \"" + targetingType.Name + "\" targeting type (ID: " + targetingType.Id + ").", issues ); throw new ValidationException(issue); } } }
public Spell(CastRoutine cast, AlterCastActionOnSetParams alterCastOnSetParams, SpellName name, School school, TargetingType targetingType, IconName icon, ClassType classType, string description, bool isCantrip, int rangeInSquares, int level, SpellScaler scaler) { this.cast = cast; this.alterCastOnSetParams = alterCastOnSetParams; this.name = name; this.school = school; this.targetingType = targetingType; this.icon = icon; this.classType = classType; this.description = description; this.isCantrip = isCantrip; this.rangeInSquares = rangeInSquares; this.level = level; this.scaler = scaler; }
public virtual string GetDescription() { string description = AbilityName + " - " + abilityType.ToString() + "\n"; description += "MP: " + abilityCost + " - Range: " + range + "\n"; description += "Target: " + TargetingType.ToString(); return(description); }
public Hull(HullParameters parameters) : base(0, 0, ItemClass.Hull, ItemType.Hull) { Model = parameters.Model; Size = parameters.Size; Mass = parameters.MassMultiplier * (4f / 3f) * Mathf.PI * Mathf.Pow(Size, 3); HullSpace = parameters.HullSpaceMultiplier * (4f / 3f) * Mathf.PI * Mathf.Pow(Size, 3); MaximumHitPoints = parameters.HitPoints; CurrentHitPoints = MaximumHitPoints; TargetingType = parameters.TargetingType; }
protected void RecalculatePortfolio( TargetingType targetingType, BroadGlobalActivePortfolio portfolio, ICollection <BgaPortfolioSecurityTargetInfo> result, IDataManager manager ) { var portfolioRepository = this.repositoryManager.ClaimPortfolioRepository(manager); var root = this.bptManager.GetRootModel( targetingType.Id, portfolio.Id, false /* we coundn't care less about benchmarks at this point */, manager, "" /* we don't care about username here */ ); var ticket = new CalculationTicket(); // let's see if computations are valid var issues = this.bptManager.Validate(root, ticket).ToList(); if (issues.Any(x => x is ErrorIssue)) { var issue = new CompoundValidationIssue("Unable to recalculate the \"" + portfolio.Name + "\" portfolio (ID: " + portfolio.Id + ").", issues); throw new ValidationException(issue); } var models = this.bptManager.Traverser.TraverseGlobe(root.Globe); foreach (var model in models) { try { this.RecalculateModelOnceResolved( model, targetingType, portfolio, result, manager, ticket ); } catch (ValidationException exception) { issues.Add(exception.Issue); } } if (issues.Any(x => x is ErrorIssue)) { var issue = new CompoundValidationIssue("Unable to recalculate the \"" + portfolio.Name + "\" portfolio (ID: " + portfolio.Id + ").", issues); throw new ValidationException(issue); } }
public TargetingRequirements(int flags, TargetingType type, TargetScanner scanner = null) { this.TargetFlags = flags; this.TargetingType = type; if (scanner == null) { this.TargetScanner = IdentityScanner; } else { this.TargetScanner = scanner; } }
public TargetingRequirements(Effect effect) { if (effect != null) { this.TargetFlags = effect.TargetFlags; this.TargetingType = effect.TargetingType(); this.TargetScanner = effect.TargetScanner; } else { this.TargetFlags = (int)TargetTypeFlag.Friendly | (int)TargetTypeFlag.Morphid; this.TargetingType = TargetingType.All; this.TargetScanner = IdentityScanner; } }
public UnitAbility(string abilityName, bool independant, TargetingType targetingType, float abilitySize, List <ActionEffect> abilityEffects, List <AbstractUnitCommand> commands, List <UnitRelativeOwner> AffectedCharacters) { AbilityName = abilityName; Independant = independant; TargetingType = targetingType; AbilitySize = abilitySize; AbilityEffects = abilityEffects; AbilityCommandQueue = new Queue <AbstractUnitCommand>(); foreach (var command in commands) { AbilityCommandQueue.Enqueue(command); } this.TargetGroup = AffectedCharacters; }
public RecalculateModelOnceResolved_IModelResolver( Hopper hopper, TargetingType targetingType, BroadGlobalActivePortfolio portfolio, ICollection <BgaPortfolioSecurityTargetInfo> result, IDataManager manager, CalculationTicket ticket ) { this.hopper = hopper; this.targetingType = targetingType; this.portfolio = portfolio; this.result = result; this.manager = manager; this.ticket = ticket; }
public Skill(string name, string description, ElementType elementType, TargetingType targetingType, int targets) { Name = name; Description = description; ElementType = ElementType; TargetingType = targetingType; if (TargetingType == TargetingType.Self) { NumberOfTarget = 1; } else { NumberOfTarget = targets; } }
public RootModel GetOverlayModel( TargetingType targetingType, String porfolioId, PortfolioRepository portfolioRepository, SecurityRepository securityRepository, IDataManager manager ) { // first, we get already saved overlays // (with overlay factor numbers) var savedFactors = manager.GetBgaPortfolioSecurityFactors(porfolioId); var itemsForSavedOverlays = savedFactors.Select(overlay => { var security = securityRepository.GetSecurity(overlay.SecurityId); var portfolio = portfolioRepository.ResolveToBottomUpPortfolio(overlay.SecurityId); var item = new ItemModel( portfolio, this.modelBuilder.CreateOverlayFactorExpression(portfolio.Name) ); item.OverlayFactor.InitialValue = overlay.Factor; return(item); }); // second we need to get potentially enabled overlays that haven't been saved yet, // but need to be offered to the user who, may be, is going to save them // (there is no overlay factor numbers) var itemsForPotentialOverlays = targetingType.BottomUpPortfolios // for all the portoflios defined for the targeting type .Where(x => !itemsForSavedOverlays.Select(y => y.BottomUpPortfolio).Contains(x) && x.Fund != null) // get only those which are not in the 'saved' list yet .Select(bottomUpPortfolio => { var item = new ItemModel( bottomUpPortfolio, this.modelBuilder.CreateOverlayFactorExpression(bottomUpPortfolio.Name) ); return(item); }); // order by name var items = itemsForSavedOverlays .Union(itemsForPotentialOverlays) .OrderBy(x => x.BottomUpPortfolio.Name); var result = new RootModel(items); return(result); }
public void StartTargeting(int casterTeamId, Vector3 initPos, UnitAbility ability, Action <TargetingResultData> targetingResultCallback) { this.targetingResultCallback = targetingResultCallback; currentTargetingType = ability.TargetingType; currentTargetGroup = ability.TargetGroup; targeterInfoGO.SetActive(true); switch (ability.TargetingType) { case TargetingType.Single: currentTargeter = pointTargeter; additionalTargeter = null; break; case TargetingType.Self: currentTargeter = pointTargeter; additionalTargeter = null; break; case TargetingType.Line: currentTargeter = lineTargeter; additionalTargeter = basicPointTargeter; break; case TargetingType.Circle: currentTargeter = circleTargeter; additionalTargeter = basicPointTargeter; break; case TargetingType.All: default: Debug.Log($"[TargeterMaster] TargeterType unhandled {ability.TargetingType}"); break; } currentTargeter?.Setup(casterTeamId, initPos, ability.AbilitySize, ability.TargetGroup); additionalTargeter?.Setup(casterTeamId, initPos, 1f, null); if (ability.TargetingType != TargetingType.Self) { inputController.TargetPointer.Any.Enable(); } inputController.TargetPointer.Execute.Enable(); inputController.TargetPointer.Execute.performed += Execute_performed; }
public void DamageFromNeutralSource(Node target, int damage, TargetingType targetingType = TargetingType.UNIT){ if (target.Unit == null) { return; } SpellInfo spellInfo = new SpellInfo (null, target); List<Node> targets=new List<Node>(); switch (targetingType) { case TargetingType.ALLENEMY: List<Unit> units = GetPlayer(turn, true).troop.units; for (int i=0; i<units.Count; ++i){ if (units[i]!=null){ targets.Add (grid.UnitsNode(units[i])); } } break; case TargetingType.ALLFRIENDLY: units = GetPlayer(turn).troop.units; for (int i=0; i<units.Count; ++i){ if (units[i]!=null){ targets.Add (grid.UnitsNode(units[i])); } } break; case TargetingType.TARGETEDAOE: targets.Add(target); Node[] neighbours = grid.GetNeighbours(target); for (int i=0; i<neighbours.Length; ++i){ if (neighbours[i]!=null){ targets.Add(neighbours[i]); } } break; default: targets.Add(target); break; } for (int i=0; i<targets.Count; ++i) { spellInfo.hitInfos.Add(new HitInfo(targets[i], 0,0)); if (targets[i].Unit!=null){ spellInfo.hitInfos[i].damage = damage; spellInfo.hitInfos[i].deathCount = spellInfo.hitInfos[i].target.TakeDamage(spellInfo.hitInfos[i].damage); spellInfo.hitInfos[i].targetDead = CheckIfDead(spellInfo.hitInfos[i].target); } } hitQueue.Enqueue ((CombatInfo)spellInfo); }
public Hull ( HullModel model, float size, float massMultiplier, float hullSpaceMultiplier, float hitPoints, TargetingType targetingType ) : base(0, 0, ItemClass.Hull, ItemType.Hull) { Model = model; Size = size; Mass = massMultiplier * (4f / 3f) * Mathf.PI * Mathf.Pow(Size, 3); HullSpace = hullSpaceMultiplier * (4f / 3f) * Mathf.PI * Mathf.Pow(Size, 3); MaximumHitPoints = hitPoints; CurrentHitPoints = MaximumHitPoints; TargetingType = targetingType; }
// Sets selection pool to possible targets private void set_selection_pool(TargetingType targeting) { // Clear up the selection pool (just in case?) clear_selection_pool(); // Clear the previously targeted targets clear_targeting_indicators(); // Update the targeting pool with possible targets based on the skills targeting type if (targeting == TargetingType.PLAYER) { selection_pool.Add(TurnManager.instance.player); } else if (targeting == TargetingType.SINGLE || targeting == TargetingType.ENEMIES) { foreach (Unit unit in TurnManager.instance.queue) { selection_pool.Add(unit); } selection_pool.RemoveAt(0); } else if (targeting == TargetingType.ANY || targeting == TargetingType.ALL) { foreach (Unit unit in TurnManager.instance.queue) { selection_pool.Add(unit); } } else { Debug.Log("Invalid targeting type " + targeting); return; } Debug.Log("Selection pool is updated for targeting type " + targeting); // Set the GUI indicator if potential targets foreach (Unit unit in selection_pool) { // Instantiate and add target_indicators target_indicators.Add(Instantiate(target_indicator, unit.transform)); } }
public Skill(string _name, Texture2D _icon, SoundEffect _sfx, string _description, SkillType _castingType, TargetingType _targetingType, float _castTime, float _cost, ResourceType _costType, params Effect[] _effects) { name = _name; description = _description; icon = _icon; sfx = _sfx; castingType = _castingType; targetingType = _targetingType; castTime = _castTime; cost = _cost; costType = _costType; effects = new Effect[MAX_EFFECTS]; for (int effectNum = 0; effectNum < effects.Length; effectNum++) { effects[effectNum] = _effects[effectNum]; } }
public Skill(string name, string iconName, string sfxName, string description, SkillType castingType, TargetingType targetingType, float castTime, float cost, ResourceType costType, params Effect[] effects) { this.name = name; this.description = description; this.iconName = iconName; this.sfxName = sfxName; this.castingType = castingType; this.targetingType = targetingType; this.castTime = castTime; this.cost = cost; this.costType = costType; this.effects = new Effect[MAX_EFFECTS]; for (int effectNum = 0; effectNum < this.effects.Length; effectNum++) { this.effects[effectNum] = effects[effectNum]; } }
protected void RecalculateModelOnceResolved( IModel model, TargetingType targetingType, BroadGlobalActivePortfolio portfolio, ICollection <BgaPortfolioSecurityTargetInfo> result, IDataManager manager, CalculationTicket ticket ) { var resolver = new RecalculateModelOnceResolved_IModelResolver( this, targetingType, portfolio, result, manager, ticket ); model.Accept(resolver); }
private void DrawTargetType() { targetType = (TargetingType)EditorGUILayout.EnumPopup("Targeting Type", targetType); switch (targetType) { case TargetingType.None: break; case TargetingType.RelativeLocation: case TargetingType.WorldLocation: targetLocation = EditorGUILayout.Vector3Field("Location", targetLocation); break; case TargetingType.TransformTarget: targetTransform = EditorGUILayout.ObjectField ("Transform", targetTransform, typeof(Transform), true) as Transform; break; } }
protected void RecalculateSecurityTargets( Decimal portfolioScaled, IBasket basket, TargetingType targetingType, BroadGlobalActivePortfolio portfolio, ICollection <BgaPortfolioSecurityTargetInfo> result, IDataManager manager, CalculationTicket ticket ) { var securityRepositry = this.repositoryManager.ClaimSecurityRepository(manager); var targetingTypeGroupRepository = this.repositoryManager.ClaimTargetingTypeGroupRepository(manager); var bpstRepository = this.repositoryManager.CliamBasketPortfolioSecurityTargetRepository(manager); var ttgbsbvRepository = this.repositoryManager.ClaimTargetingTypeGroupBasketSecurityBaseValueRepository(manager); var targetingTypeGroup = targetingTypeGroupRepository.GetTargetingTypeGroup(targetingType.TargetingTypeGroupId); var portfolioRepository = this.repositoryManager.ClaimPortfolioRepository(manager); var core = this.bpstManager.GetCoreModel( targetingTypeGroup, basket, securityRepositry, ttgbsbvRepository, bpstRepository, portfolioRepository ); this.MakeSureBpstCoreModelIsValid(core, ticket); foreach (var securityModel in core.Securities) { var unscaledTarget = this.ResolveToUnscaledTarget(portfolio, securityModel, ticket); var scaledTaget = unscaledTarget * portfolioScaled; var targetInfo = new BgaPortfolioSecurityTargetInfo( portfolio.Id, securityModel.Security.Id, scaledTaget ); result.Add(targetInfo); } }
public List<Node> ValidSpellTargets(TargetingType targetingType){ Node[] allNodes = grid.GetAllNodes (); List<Node> validCastTargets = new List<Node>(); switch(targetingType){ case TargetingType.ALLENEMY: return validCastTargets; case TargetingType.ALLFRIENDLY: return validCastTargets; case TargetingType.TARGETEDAOE: for (int i=0; i<allNodes.Length; ++i) { validCastTargets.Add(allNodes [i]); } return validCastTargets; case TargetingType.UNIT: List<Unit> units = GetPlayer (turn).troop.units; for (int i=0; i<units.Count; ++i) { if (units[i]!=null ){ //grid.UnitsNode(units[i]).visualizationTile.SetEmission(true); validCastTargets.Add(grid.UnitsNode(units[i])); } } units = GetPlayer (turn, true).troop.units; for (int i=0; i<units.Count; ++i) { if (units[i]!=null && units[i].Visible ){ validCastTargets.Add(grid.UnitsNode(units[i])); } } return validCastTargets; case TargetingType.UNOCCUPIEDNODE: for (int i=0; i<allNodes.Length; ++i) { if (allNodes[i].Unit==null || (allNodes[i].Unit!= null && !allNodes[i].Unit.Visible && !IsThisUnitsTurn(allNodes[i].Unit))){ validCastTargets.Add(allNodes [i]); } } return validCastTargets; } return null; }
public ActiveSkill(string name, string description, ElementType elementType, TargetingType targetingType, int targets) : base(name, description, elementType, targetingType, targets) { SkillType = SkillType.Active; }
public ActiveAttackSkill(string name, string description, ElementType elementType, double damage, TargetingType targetingType, int targets) : base(name, description, elementType, targetingType, targets) { Damage = damage; }
public static void WriteTargetingType(this PacketWriter writer, TargetingType data) { writer.WriteByte((byte)data); }
public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); //Targeting EditorGUILayout.LabelField("Targeting Settings", EditorStyles.boldLabel); so.PropertyField("_targetingBehavior"); TargetingType targetingBehavior = (TargetingType)so.FindProperty("_targetingBehavior").enumValueIndex; switch (targetingBehavior) { case TargetingType.Positional: case TargetingType.Seeking: so.PropertyField("_speed"); break; case TargetingType.Timed: so.PropertyField("_delay"); break; } EditorGUILayout.Space(); //Damage EditorGUILayout.LabelField("Damage Settings", EditorStyles.boldLabel); so.PropertyField("_damageBehavior"); switch ((DamageType)so.FindProperty("_damageBehavior").enumValueIndex) { case DamageType.Cone: so.PropertyField("_angle"); break; case DamageType.Area: so.PropertyField("_radius"); break; case DamageType.Single: break; } EditorGUILayout.Space(); //Trajectory EditorGUILayout.LabelField("Trajectory Settings", EditorStyles.boldLabel); so.PropertyField("_trajectoryBehavior"); TrajectoryType trajectoryBehavior = (TrajectoryType)so.FindProperty("_trajectoryBehavior").enumValueIndex; switch (trajectoryBehavior) { case TrajectoryType.Linear: break; case TrajectoryType.Interpolated: so.PropertyField("_interpolationRate"); break; case TrajectoryType.Arc: so.PropertyField("_arcHeight"); break; } EditorGUILayout.Space(); //Visuals EditorGUILayout.LabelField("Visuals Settings", EditorStyles.boldLabel); so.PropertyField("_startEffect"); so.PropertyField("_endEffect"); so.PropertyField("_attachEndEffectToTarget"); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(target); } }
public void Template() { TemplateStatus.Templating = true; this.Cost = Effect.Cost(); this.Text = Effect.Text; TargetingRequirements req = new TargetingRequirements(Effect); this.TargetableGuids = req.AllowedTargets().ToArray(); this.TargetingType = Effect.TargetingType(); TemplateStatus.Templating = false; }
public void Visualize() { if (this.IsActive) { if (this.CanVisualize) { TargetingType targetingBehavior = this.TargetingBehavior; if (targetingBehavior != TargetingType.Timed) { if (targetingBehavior == TargetingType.Seeking) { if (this.Target.Body.SetPositionBuffer) { this.TargetHeight = this.Target.CachedTransform.position.y; } } } switch (this.Trajectory) { case TrajectoryType.Linear: if (!this.HeightReached) { this.CurrentHeight += this.HeightSpeed * Time.deltaTime; if (this.HeightSpeed < 0f) { if (this.CurrentHeight <= this.TargetHeight) { this.HeightReached = true; this.CurrentHeight = this.TargetHeight; } } else { if (this.CurrentHeight >= this.TargetHeight) { this.HeightReached = true; this.CurrentHeight = this.TargetHeight; } } } if (this.CanRotate) { this.cachedTransform.LookAt(this.Target.CachedTransform.position); } break; case TrajectoryType.Arc: { float num = (float)this.AliveTime / 32f; this.CurrentHeight = this.arcStartHeight + num * this.arcStartVerticalSpeed + -9.8f * num * num; if (this.CanRotate) { Vector3 vector = this.arcStartVelocity + -9.8f * num * Vector3.up; } break; } case TrajectoryType.Interpolated: if (!this.HeightReached) { this.CurrentHeight = Mathf.Lerp(this.CurrentHeight, this.TargetHeight, this.InterpolationRate * Time.deltaTime); } if (this.CanRotate) { this.cachedTransform.LookAt(this.Target.VisualCenter); } break; } LSProjectile.newPos = this.Position.ToVector3(this.CurrentHeight); this.cachedTransform.position = LSProjectile.newPos; } if (this.onVisualize.IsNotNull()) { this.onVisualize.Invoke(); } } else { this.cachedGameObject.SetActiveIfNot(false); } }
public override void ReadBody(PacketReader reader) { TargetingType = reader.ReadTargetingType(); }
public Transform GetTarget(TargetingType targetingType) { Transform Target = null; switch (targetingType) { case TargetingType.FirstSee: Target = SensedPlayers[0].transform; break; case TargetingType.Closest: float dist = float.PositiveInfinity; foreach (var sensed in SensedPlayers) { float actDis = Vector2.Distance(sensed.transform.position, transform.position); if (actDis < dist) { dist = actDis; Target = sensed.transform; } } break; case TargetingType.LowestHp: float hp = float.PositiveInfinity; foreach (var sensed in SensedPlayers) { float actHp = sensed.GetComponent <GeneralStatistics>().HealthActual; if (actHp < hp) { hp = actHp; Target = sensed.transform; } } break; case TargetingType.HighestHp: float hph = 0; foreach (var sensed in SensedPlayers) { float actHp = sensed.GetComponent <GeneralStatistics>().HealthActual; if (actHp > hph) { hp = actHp; Target = sensed.transform; } } break; case TargetingType.Slowest: float ms = float.PositiveInfinity; foreach (var sensed in SensedPlayers) { float actms = sensed.GetComponent <GeneralStatistics>().MoveSpeed; if (actms < ms) { hp = actms; Target = sensed.transform; } } break; default: break; } return(Target); }
public override void OnInspectorGUI() { EditorGUI.BeginChangeCheck(); //Targeting EditorGUILayout.LabelField("Targeting Settings", EditorStyles.boldLabel); so.PropertyField("_targetingBehavior"); TargetingType targetingBehavior = (TargetingType)so.FindProperty("_targetingBehavior").enumValueIndex; switch (targetingBehavior) { case TargetingType.Directional: so.PropertyField("_speed"); break; case TargetingType.Positional: case TargetingType.Homing: so.PropertyField("_speed"); so.PropertyField("_visualArc"); break; case TargetingType.Timed: so.PropertyField("_delay"); so.PropertyField("_lastingDuration"); so.PropertyField("_tickRate"); break; } EditorGUILayout.Space(); //Damage EditorGUILayout.LabelField("Damage Settings", EditorStyles.boldLabel); so.PropertyField("_hitBehavior"); switch ((HitType)so.FindProperty("_hitBehavior").enumValueIndex) { case HitType.Cone: so.PropertyField("_angle"); so.PropertyField("_radius"); break; case HitType.Area: so.PropertyField("_radius"); break; case HitType.Single: break; } EditorGUILayout.Space(); //Trajectory EditorGUILayout.LabelField("Trajectory Settings", EditorStyles.boldLabel); EditorGUILayout.Space(); //Visuals EditorGUILayout.LabelField("Visuals Settings", EditorStyles.boldLabel); SerializedProperty useEffectProp = so.FindProperty("UseEffects"); EditorGUILayout.PropertyField(useEffectProp); if (useEffectProp.boolValue) { so.PropertyField("_startFX"); so.PropertyField("_hitFX"); so.PropertyField("_attachEndEffectToTarget"); } //PAPPS ADDED THIS: so.PropertyField("DoReleaseChildren"); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(target); } }
internal void SetPlayRequirements(Dictionary <PlayReq, int> playReqs) { PlayRequirements = playReqs; bool needsTarget = false; TargetingType type = TargetingType.All; foreach (KeyValuePair <PlayReq, int> requirement in playReqs) { switch (requirement.Key) { case PlayReq.REQ_TARGET_TO_PLAY: MustHaveTargetToPlay = true; needsTarget = true; break; case PlayReq.REQ_DRAG_TO_PLAY: // TODO case PlayReq.REQ_NONSELF_TARGET: case PlayReq.REQ_TARGET_IF_AVAILABLE: needsTarget = true; break; case PlayReq.REQ_MINION_TARGET: type &= ~TargetingType.Hero; break; case PlayReq.REQ_FRIENDLY_TARGET: type &= ~TargetingType.Enemy; break; case PlayReq.REQ_ENEMY_TARGET: type &= ~TargetingType.Friendly; break; case PlayReq.REQ_HERO_TARGET: type &= ~TargetingType.Minion; break; case PlayReq.REQ_TARGET_WITH_RACE: TargetingPredicate += TargetingPredicates.ReqTargetWithRace(requirement.Value); break; case PlayReq.REQ_FROZEN_TARGET: TargetingPredicate += TargetingPredicates.ReqFrozenTarget; break; case PlayReq.REQ_DAMAGED_TARGET: TargetingPredicate += TargetingPredicates.ReqDamagedTarget; break; case PlayReq.REQ_UNDAMAGED_TARGET: TargetingPredicate += TargetingPredicates.ReqUndamagedTarget; break; case PlayReq.REQ_TARGET_MAX_ATTACK: TargetingPredicate += TargetingPredicates.ReqTargetMaxAttack(requirement.Value); break; case PlayReq.REQ_TARGET_MIN_ATTACK: TargetingPredicate += TargetingPredicates.ReqTargetMinAttack(requirement.Value); break; case PlayReq.REQ_MUST_TARGET_TAUNTER: TargetingPredicate += TargetingPredicates.ReqMustTargetTaunter; break; case PlayReq.REQ_STEALTHED_TARGET: TargetingPredicate += TargetingPredicates.ReqStealthedTarget; break; case PlayReq.REQ_TARGET_WITH_DEATHRATTLE: TargetingPredicate += TargetingPredicates.ReqTargetWithDeathrattle; break; case PlayReq.REQ_LEGENDARY_TARGET: TargetingPredicate += TargetingPredicates.ReqLegendaryTarget; break; case PlayReq.REQ_TARGET_FOR_COMBO: needsTarget = true; TargetingAvailabilityPredicate += TargetingPredicates.ReqTargetForCombo; break; case PlayReq.REQ_TARGET_IF_AVAILABE_AND_ELEMENTAL_PLAYED_LAST_TURN: needsTarget = true; TargetingAvailabilityPredicate += TargetingPredicates.ElementalPlayedLastTurn; break; case PlayReq.REQ_TARGET_IF_AVAILABLE_AND_DRAGON_IN_HAND: needsTarget = true; TargetingAvailabilityPredicate += TargetingPredicates.DragonInHand; break; case PlayReq.REQ_TARGET_IF_AVAILABLE_AND_MINIMUM_FRIENDLY_MINIONS: needsTarget = true; TargetingAvailabilityPredicate += TargetingPredicates.MinimumFriendlyMinions(requirement.Value); break; case PlayReq.REQ_TARGET_IF_AVAILABLE_AND_MINIMUM_FRIENDLY_SECRETS: needsTarget = true; TargetingAvailabilityPredicate += TargetingPredicates.MinimumFriendlySecrets(requirement.Value); break; case PlayReq.REQ_TARGET_IF_AVAILABLE_AND_NO_3_COST_CARD_IN_DECK: // TODO TargetingType = TargetingType.AllMinions; break; case PlayReq.REQ_TARGET_IF_AVAILABLE_AND_HERO_HAS_ATTACK: needsTarget = true; TargetingAvailabilityPredicate += TargetingPredicates.ReqHeroHasAttack; break; case PlayReq.REQ_NUM_MINION_SLOTS: PlayAvailabilityPredicate += TargetingPredicates.ReqNumMinionSlots; break; case PlayReq.REQ_MINIMUM_ENEMY_MINIONS: PlayAvailabilityPredicate += TargetingPredicates.ReqMinimumEnemyMinions(requirement.Value); break; case PlayReq.REQ_MINIMUM_TOTAL_MINIONS: PlayAvailabilityPredicate += TargetingPredicates.ReqMinimumTotalMinions(requirement.Value); break; case PlayReq.REQ_HAND_NOT_FULL: PlayAvailabilityPredicate += TargetingPredicates.ReqHandNotFull; break; case PlayReq.REQ_WEAPON_EQUIPPED: PlayAvailabilityPredicate += TargetingPredicates.ReqWeaponEquipped; break; case PlayReq.REQ_ENTIRE_ENTOURAGE_NOT_IN_PLAY: PlayAvailabilityPredicate += TargetingPredicates.ReqEntireEntourageNotInPlay(AssetId); break; case PlayReq.REQ_FRIENDLY_MINION_DIED_THIS_GAME: PlayAvailabilityPredicate += TargetingPredicates.ReqFriendlyMinionDiedThisGame; break; case PlayReq.REQ_FRIENDLY_MINION_OF_RACE_DIED_THIS_TURN: PlayAvailabilityPredicate += TargetingPredicates.ReqFriendlyMinionOfRaceDiedThisTurn((Race)requirement.Value); break; case PlayReq.REQ_MUST_PLAY_OTHER_CARD_FIRST: PlayAvailabilityPredicate += (c, card) => false; break; // REQ_STEADY_SHOT // REQ_MINION_OR_ENEMY_HERO // Steady Shot // REQ_MINION_SLOT_OR_MANA_CRYSTAL_SLOT // Jade Blossom case PlayReq.REQ_SECRET_ZONE_CAP_FOR_NON_SECRET: PlayAvailabilityPredicate += TargetingPredicates.ReqSecretZoneCapForNonSecret; break; } } if (needsTarget) { //if ((type & TargetingType.Enemy) != TargetingType.Enemy && // (type & TargetingType.Friendly) != TargetingType.Friendly) //{ // type |= TargetingType.Enemy; // type |= TargetingType.Friendly; //} TargetingType = type; } }