//Should be changed to calculate life, this function would then be used for all cases in which health pools are changed public void CalculateHealth(GameObject aCause, float aValue, EffectType aHealthEffect = EffectType.loss) //GameObject dealing damage, Damage, DamageType { try { switch (aHealthEffect) { case EffectType.loss: if (m_Pools.Health > 0) { m_Pools.Health -= aValue; m_Actor.m_HUD.UpdatePools(); } break; case EffectType.gain: m_Pools.Health += aValue; m_Actor.m_HUD.UpdatePools(); break; } if (m_Pools.Health > 0) { return; } m_Pools.Health = 0; m_Actor.m_HUD.DisplayGameOver(); } catch { Debug.Log(m_Actor.name + " Statistics HUD reference is NULL"); } }
public Ongoing(Keyword keyword, EffectType effect_type, int modifier, int duration) { key = keyword; type = effect_type; mod = modifier; dur = duration; }
internal static async Task<IVideoEffectDefinition> CreateEffectDefinitionAsync(EffectType effectType) { switch (effectType) { case EffectType.Lumia: return new LumiaEffectDefinition(() => { return new IFilter[] { new AntiqueFilter(), new FlipFilter(FlipMode.Horizontal) }; }); case EffectType.ShaderNv12: IBuffer shaderY = await PathIO.ReadBufferAsync("ms-appx:///Invert_093_NV12_Y.cso"); IBuffer shaderUV = await PathIO.ReadBufferAsync("ms-appx:///Invert_093_NV12_UV.cso"); return new ShaderEffectDefinitionNv12(shaderY, shaderUV); case EffectType.ShaderBgrx8: IBuffer shader = await PathIO.ReadBufferAsync("ms-appx:///Invert_093_RGB32.cso"); return new ShaderEffectDefinitionBgrx8(shader); default: throw new ArgumentException("Invalid effect type"); } }
// --- Constructors --- public StatEffect(EffectType pmType, string pmName, string pmDesc, StatEffectEvent pmEffectEvent, int pmTurnsLeft) { type= pmType; name= pmName; desc= pmDesc; effectEvent= pmEffectEvent; turnsLeft= pmTurnsLeft; }
public override void Read(PacketReader r) { EffectType = (EffectType)r.ReadByte(); TargetId = r.ReadInt32(); PosA =(Location) new Location().Read(r); PosB = (Location) new Location().Read(r); Color = ARGB.Read(r); }
public void ReadPacket(IMinecraftStream stream) { Effect = (EffectType)stream.ReadInt32(); X = stream.ReadInt32(); Y = stream.ReadInt8(); Z = stream.ReadInt32(); Data = stream.ReadInt32(); }
public Effect(Characteristic target, int amount, EffectType type, int duration, DurationType durType) { Target = target; Amount = amount; Type = type; Duration = duration; DurType = durType; }
public CircleObject(CircleObject baseInstance) { //Copy from baseInstance Location = baseInstance.Location; Radius = baseInstance.Radius; StartTime = baseInstance.StartTime; Type = baseInstance.Type; Effect = baseInstance.Effect; }
private void Avatars_OnEffect(EffectType type, LLUUID sourceID, LLUUID targetID, LLVector3d targetPos, float duration, LLUUID id) { if (ShowEffects) Console.WriteLine( "ViewerEffect [{0}]: SourceID: {1} TargetID: {2} TargetPos: {3} Duration: {4} ID: {5}", type, sourceID.ToString(), targetID.ToString(), targetPos, duration, id.ToString()); }
public void AddStatusEffect(EffectType type) { StatusEffect effect = GetEffectFromEnum(type); if (effect == null) return; if(type == EffectType.HIT) ResetEffects(); AddStatusEffect(effect); }
//---------------------------------------------------------------------- // Here, we are going to search the quadrant that it is ahead of the player, because // he is running //---------------------------------------------------------------------- public static bool FindAhead( PlayerMobile pm, Point3D centerPoint, ref Point3D spawnPoint, LandType landType, int distance, EffectType effectType, int effectHue ) { Direction dir = (Direction)((int)pm.Direction & 0x0f); Point3D foundPoint = new Point3D(); Tour tour = delegate( Map map, int x, int y ) { if( Utility.RandomDouble() < .5 ) return false; // break it up a little. Point2D currentPoint = new Point2D( pm.Location.X + x, pm.Location.Y + y ); if( FindSpawnTileInternal( pm, centerPoint, currentPoint, ref foundPoint, landType, effectType, effectHue ) ) { return true; } return false; }; bool found = Search.Octant( pm.Map, dir, distance, SearchDirection.Inwards, tour ); if( found ) { spawnPoint.X = foundPoint.X; spawnPoint.Y = foundPoint.Y; spawnPoint.Z = foundPoint.Z; return true; } return false; }
public void addEffect(EffectType pType, Vector2 pOrigin, float pAngle) { for (int i = 0; i < MAX_EFFECTS; i++) { if (!mAllEffects[i].isAlive()) { mAllEffects[i].initialize(pType, pOrigin, ref mParticles, pAngle); break; } } }
/// <summary> /// Basiskonstruktor. /// </summary> public SpriteEffect() { elapsedTime = 0; CurrentSprite = Vector2.Zero; Size = Vector2.Zero; SheetSize = Vector2.Zero; Offset = 0; ChangeSpeed = 0.0f; CicleDirection = SpriteCicleDirection.Left; SpriteType = EffectType.None; }
/// <summary> /// Creates a new instance of Effect /// </summary> /// <param name="aDuration">The duration of the effect</param> public Effect(EffectType aEffectType, int aMagnitude, int aDuration = 1) { // Set the effect type. EffectType = aEffectType; // Set the duration of this effect. Duration = aDuration; // Set the magnitude of this effect. Magnitude = aMagnitude; }
//---------------------------------------------------------------------- // Opposite of the above; we want the first spawn location closest to // the center -- no closer than the initial distance //---------------------------------------------------------------------- public static bool FindOutwards( PlayerMobile pm, Point3D centerPoint, ref Point3D spawnPoint, LandType landType, int distance, EffectType effectType, int effectHue ) { return FindSpiral( pm, centerPoint, ref spawnPoint, landType, distance, false, effectType, effectHue ); }
public IList<IEffectSpriteInfo> GetEffectInfo(EffectType effectType, int effectID) { switch (effectType) { case EffectType.Potion: return ResolvePotionEffect((HardCodedPotionEffect)effectID); case EffectType.Spell: return ResolveSpellEffect((HardCodedSpellGraphic)effectID); case EffectType.WarpOriginal: case EffectType.WarpDestination: return GetWarpEffect(effectType); case EffectType.WaterSplashies: return GetWaterEffect(); default: throw new ArgumentOutOfRangeException("effectType", effectType, null); } }
public IList<SoundEffectInstance> GetSoundEffectsForEffect(EffectType type, int id) { switch (type) { case EffectType.Potion: return GetPotionSoundEffect(id); case EffectType.Spell: return GetSpellSoundEffect(id); case EffectType.WarpOriginal: case EffectType.WarpDestination: return GetWarpSoundEffect(type); case EffectType.WaterSplashies: return GetWaterSoundEffect(); default: throw new ArgumentOutOfRangeException("type", type, null); } }
// //-- Send Message Calls // This section is for the MESSAGES such as the ones described in the // test instructions. // public static bool SendAffectMessage( InstanceID recipient, EffectType type, int intensity, double time = -1.0d ) { Entity targetEntity = null; if( s_GameEntities.TryGetValue( target, out targetEntity ) ) { targetEntity.Affect( type, intensity ); return true; } return false; }
public void CopyFrom(AttackInformation other) { this.Id = other.Id; this.Power = other.Power; this.StayingTime = other.StayingTime; this.Type = other.Type; this.Effect = other.Effect; this.SourcePositionHorizontal = other.SourcePositionHorizontal; this.SourcePositionVertical = other.SourcePositionVertical; }
internal EffectAudio(EffectType eType) : base(eType) { try { aChannels = null; //комментарии в IAudio } catch { Fail(); throw; } }
/// <summary> /// Primary constructor for Magic class. For single-effect spells. /// </summary> /// <param name="name">Name of the Spell.</param> /// <param name="cost">Cost of the Spell</param> /// <param name="description">Detailed Description of the Spell. Should not include Flavor Text.</param> /// <param name="potency">Numerical modifier for primary effect of spell.</param> /// <param name="accuracy">Base accuracy of the spell.</param> /// <param name="spellmagicschooltype">School of magic the spell falls under.</param> /// <param name="spellelementtype">Elemental effect of the spell.</param> /// <param name="spelleffecttype">Main effect type of the spell.</param> public Magic(string name = "", int cost = 0, string description = "", int potency = 0, double accuracy = 0, MagicSchoolType spellmagicschooltype = MagicSchoolType.Black, ElementType spellelementtype = ElementType.Light, EffectType spelleffecttype = EffectType.Damage) { Name = name; Cost = cost; Description = description; Potency = potency; Accuracy = accuracy; SpellMagicSchoolType = spellmagicschooltype; SpellElementType = spellelementtype; SkillEffectType = spelleffecttype; }
async Task CS_WP_MT_Basic(EffectType effectType) { StorageFile source = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Input/Car.mp4")); StorageFile destination = await KnownFolders.VideosLibrary.CreateFileAsync("CS_WP_MT_Basic" + effectType + ".mp4", CreationCollisionOption.ReplaceExisting); var definition = await Utils.CreateEffectDefinitionAsync(effectType); var transcoder = new MediaTranscoder(); transcoder.AddVideoEffect(definition.ActivatableClassId, true, definition.Properties); PrepareTranscodeResult transcode = await transcoder.PrepareFileTranscodeAsync(source, destination, MediaEncodingProfile.CreateMp4(VideoEncodingQuality.Qvga)); await transcode.TranscodeAsync(); }
static Color ColorForEffect(EffectType t, Color orig) { switch (t) { case EffectType.Black: return Color.FromArgb(orig.A, Color.Black); case EffectType.Desaturated: var lum = (int)(255 * orig.GetBrightness()); return Color.FromArgb(orig.A, lum, lum, lum); default: case EffectType.None: return orig; } }
private XGEffect(EffectType effectType, int value, string name, string description, int[] paramTypeIDs, int[] initialValues) { Debug.Assert(paramTypeIDs.Length == 16); Debug.Assert(initialValues.Length == 16); this.EffectValue = value; this.Name = name; this.Description = description; this.ParameterTypes = new ReadOnlyCollection<XGEffectParam>(Array.ConvertAll(paramTypeIDs, id => paramTypeTable[id])); this.InitialValues = new ReadOnlyCollection<int>(initialValues); this.SelectableForChorus = (effectType & EffectType.Chorus) != 0; this.SelectableForReverb = (effectType & EffectType.Reverb) != 0; this.ExDataUsed = (effectType & EffectType.UseDataMSB) != 0; }
async Task CS_WP_MC_Basic(EffectType effectType) { StorageFile source = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Input/Car.mp4")); StorageFile destination = await KnownFolders.VideosLibrary.CreateFileAsync("CS_WP_MC_Basic_" + effectType + ".mp4", CreationCollisionOption.ReplaceExisting); var definition = await Utils.CreateEffectDefinitionAsync(effectType); var clip = await MediaClip.CreateFromFileAsync(source); clip.VideoEffectDefinitions.Add(definition); var composition = new MediaComposition(); composition.Clips.Add(clip); await composition.RenderToFileAsync(destination); }
public bool HasEffect(EffectType type) { for(int i = 0; i< statusEffects.Count; i++) { Type t = statusEffects[i].GetType(); Type TT = GetEffectFromEnum(type).GetType(); if(t.Equals(TT)) { return true; } } return false; }
public void Trigger(EffectType effectType) { switch (effectType) { case EffectType.RocketTrail: { this.TrailEmitter.Trigger(this.Position); break; } case EffectType.RocketExplosion: { this.ExplosionEmitter.Trigger(this.Position); break; } } }
public void initialize(EffectType pType, Vector2 pOrigin, ref Particle[] particleCollection, float angle = 0.0f) { mParticles = particleCollection; mType = pType; mOrigin = pOrigin; mAngle = angle; switch (mType) { case EffectType.explosionOnGround: initFountain(); break; case EffectType.explosionFromCannon: initExplosion(); break; } }
public void CreateFloatingSpecialText(Vector3 position, EffectType type, int percentage) { GameObject newFloatingText = (GameObject)Instantiate(_floatingText); newFloatingText.transform.position = TextReposition(position); TextMesh textMesh = newFloatingText.GetComponent<TextMesh>(); string text = string.Empty; switch (type) { case EffectType.run: if (percentage >= 0) { text = "speed"; } else { text = "slowed"; } break; case EffectType.stun: text = "stunned"; break; case EffectType.def: if (percentage >= 0) { text = "defence"; } else { text = "volnurable"; } break; } textMesh.text = text; textMesh.color = Color.cyan; _gameObjectList.Add(newFloatingText); }
internal EffectVideo(EffectType eType) : base(eType) { try { bCUDA = Preferences.bCUDA; nFrameCurrent = 0; stArea = new Area(0, 0, 0, 0); nMaxOpacity = 255; nInDissolve = 0; nOutDissolve = 0; } catch { Fail(); throw; } }
//construct for battle effect font public BattleEffectFont(Transform parent, PackedSprite effectFont, SpriteText textSkill, PackedSprite number, Vector3 position, Vector3 offset, EffectType type, int val, string skillName) { // _mainCamera = Globals.Instance.MSceneManager.mMainCamera; // _uICamera = Globals.Instance.MGUIManager.MGUICamera; this.effectFontPreb = effectFont; this.textSkillPreb = textSkill; this.numberPreb = number; this.ReleaseEffect(parent, position, type, val, skillName, offset); }
public override bool triggersAs(EffectType triggerType) { return(triggerType == EffectType.meta || triggerType == EffectType.cardDrawn); }
public override bool triggersAs(EffectType triggerType) { return(base.triggersAs(triggerType) || innerEffect.triggersAs(triggerType)); } //trigger as a meta effect, but also as whatever the target effect is
/// <summary> /// Process an incoming effect /// </summary> private void ViewerEffectHandler(Packet packet, Simulator simulator) { ViewerEffectPacket effect = (ViewerEffectPacket)packet; foreach (ViewerEffectPacket.EffectBlock block in effect.Effect) { EffectType type = (EffectType)block.Type; //LLColor color; //if (block.Color.Length == 4) //{ // color = new LLColor(block.Color, 0); //} //else //{ // Client.Log("Received a ViewerEffect.EffectBlock.Color array with " + block.Color.Length + // " bytes", Helpers.LogLevel.Warning); // color = LLColor.Black; //} // Each ViewerEffect type uses it's own custom binary format for additional data. Fun eh? switch (type) { case EffectType.Text: Logger.Log("Received a ViewerEffect of type " + type.ToString() + ", implement me!", Helpers.LogLevel.Warning, Client); break; case EffectType.Icon: Logger.Log("Received a ViewerEffect of type " + type.ToString() + ", implement me!", Helpers.LogLevel.Warning, Client); break; case EffectType.Connector: Logger.Log("Received a ViewerEffect of type " + type.ToString() + ", implement me!", Helpers.LogLevel.Warning, Client); break; case EffectType.FlexibleObject: Logger.Log("Received a ViewerEffect of type " + type.ToString() + ", implement me!", Helpers.LogLevel.Warning, Client); break; case EffectType.AnimalControls: Logger.Log("Received a ViewerEffect of type " + type.ToString() + ", implement me!", Helpers.LogLevel.Warning, Client); break; case EffectType.AnimationObject: Logger.Log("Received a ViewerEffect of type " + type.ToString() + ", implement me!", Helpers.LogLevel.Warning, Client); break; case EffectType.Cloth: Logger.Log("Received a ViewerEffect of type " + type.ToString() + ", implement me!", Helpers.LogLevel.Warning, Client); break; case EffectType.Glow: Logger.Log("Received a Glow ViewerEffect which is not implemented yet", Helpers.LogLevel.Warning, Client); break; case EffectType.Beam: case EffectType.Point: case EffectType.Trail: case EffectType.Sphere: case EffectType.Spiral: case EffectType.Edit: if (OnEffect != null) { if (block.TypeData.Length == 56) { LLUUID sourceAvatar = new LLUUID(block.TypeData, 0); LLUUID targetObject = new LLUUID(block.TypeData, 16); LLVector3d targetPos = new LLVector3d(block.TypeData, 32); try { OnEffect(type, sourceAvatar, targetObject, targetPos, block.Duration, block.ID); } catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); } } else { Logger.Log("Received a " + type.ToString() + " ViewerEffect with an incorrect TypeData size of " + block.TypeData.Length + " bytes", Helpers.LogLevel.Warning, Client); } } break; case EffectType.LookAt: if (OnLookAt != null) { if (block.TypeData.Length == 57) { LLUUID sourceAvatar = new LLUUID(block.TypeData, 0); LLUUID targetObject = new LLUUID(block.TypeData, 16); LLVector3d targetPos = new LLVector3d(block.TypeData, 32); LookAtType lookAt = (LookAtType)block.TypeData[56]; try { OnLookAt(sourceAvatar, targetObject, targetPos, lookAt, block.Duration, block.ID); } catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); } } else { Logger.Log("Received a LookAt ViewerEffect with an incorrect TypeData size of " + block.TypeData.Length + " bytes", Helpers.LogLevel.Warning, Client); } } break; case EffectType.PointAt: if (OnPointAt != null) { if (block.TypeData.Length == 57) { LLUUID sourceAvatar = new LLUUID(block.TypeData, 0); LLUUID targetObject = new LLUUID(block.TypeData, 16); LLVector3d targetPos = new LLVector3d(block.TypeData, 32); PointAtType pointAt = (PointAtType)block.TypeData[56]; try { OnPointAt(sourceAvatar, targetObject, targetPos, pointAt, block.Duration, block.ID); } catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); } } else { Logger.Log("Received a PointAt ViewerEffect with an incorrect TypeData size of " + block.TypeData.Length + " bytes", Helpers.LogLevel.Warning, Client); } } break; default: Logger.Log("Received a ViewerEffect with an unknown type " + type, Helpers.LogLevel.Warning, Client); break; } } }
/// <summary> /// /Inserts a list of effects into the Database. /// </summary> /// <param name="effects"></param> public void insertNewEffects(List <Effect> effects, string typeId, int id) { connection = new SqlConnection(connectionString); connection.Open(); string queryIdSubstring = ""; switch (typeId) { case "BaseId": queryIdSubstring = "@BaseId, NULL, NULL"; break; case "IngredientId": queryIdSubstring = "NULL, @IngredientId, NULL"; break; case "PotionId": queryIdSubstring = "NULL, NULL, @PotionId"; break; } foreach (Effect e in effects) { string query = ""; EffectType type = e.getEffectEnumType(); SqlCommand command; switch (type) { case EffectType.NONE: NoEffect ne = (NoEffect)e; query = "INSERT INTO Effect VALUES(@Name, @EffectType, NULL, NULL, NULL, " + queryIdSubstring + ", NULL)"; Console.WriteLine(query); command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@Name", ne.name); command.Parameters.AddWithValue("@EffectType", (int)type); command.Parameters.AddWithValue("@" + typeId, id); command.ExecuteNonQuery(); break; case EffectType.STAT: StatEffect se = (StatEffect)e; query = "INSERT INTO Effect VALUES(@Name, @EffectType, @StatType, NULL, NULL, " + queryIdSubstring + ", @Intensity)"; command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@Name", se.name); command.Parameters.AddWithValue("@EffectType", (int)type); command.Parameters.AddWithValue("@StatType", (int)se.getAffectedStat()); command.Parameters.AddWithValue("@" + typeId, id); command.Parameters.AddWithValue("@Intensity", se.getIntensity()); command.ExecuteNonQuery(); break; case EffectType.BUFF: BuffEffect be = (BuffEffect)e; query = "INSERT INTO Effect VALUES(@Name, @EffectType, NULL, @BuffType, NULL, " + queryIdSubstring + ", @Intensity)"; command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@Name", be.name); command.Parameters.AddWithValue("@EffectType", (int)type); command.Parameters.AddWithValue("@BuffType", (int)be.getBuff()); command.Parameters.AddWithValue("@" + typeId, id); command.Parameters.AddWithValue("@Intensity", be.getIntensity()); command.ExecuteNonQuery(); break; case EffectType.DEBUFF: DebuffEffect de = (DebuffEffect)e; query = "INSERT INTO Effect VALUES(@Name, @EffectType, NULL, NULL, @DebuffType, " + queryIdSubstring + ", @Intensity)"; command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@Name", de.name); command.Parameters.AddWithValue("@EffectType", (int)type); command.Parameters.AddWithValue("@DebuffType", (int)de.getDebuff()); command.Parameters.AddWithValue("@" + typeId, id); command.Parameters.AddWithValue("@Intensity", de.getIntensity()); command.ExecuteNonQuery(); break; } } connection.Close(); }
//regardless of how the inner effect normally triggers, we want it to fire once every round. We need to keep the triggertype == EffectType.meta so we dont break EffectData.cloneEffect() public override bool triggersAs(EffectType triggerType) { return((triggerType == EffectType.spawn) || (triggerType == EffectType.meta) || base.triggersAs(triggerType)); }
// ========================================================= CONSTRUCTION public ActionEffect(string name, EffectType type, Action <T, EffectType> action) { Name = name; Type = type; _action = action; }
public EffectResult(EffectType type, bool success) { Type = type; Success = success; }
public Effect(EffectType _type, float seconds, float _value = 0) { time = Time.time + seconds; type = _type; value = _value; }
} //always trigger inner effect public override bool triggersAs(EffectType triggerType) { return(triggerType == EffectType.enemyDamaged || //allow this to trigger as an onDamage effect even if the child does not triggerType == EffectType.sourceTracked || //we want to be notified of the tower when we get added so we can set up the description base.triggersAs(triggerType)); //maintain trigger types from the base class }
public EffectBuilder SetType(EffectType type) { _type = type; return(this); }
//crit font private void ReleaseEffect(Transform parent, Vector3 position, EffectType type, int val, string skillName, Vector3 offset) { // Vector3 warshipViewPosition = _mainCamera.WorldToViewportPoint(position); // Vector3 uiOffset = new Vector3((warshipViewPosition.x - 0.5f) * Screen.width,(warshipViewPosition.y - 0.5f) * Screen.height,100); _gobjCrit = new GameObject("BattleCritFont"); _gobjCrit.transform.position = position; _gobjCrit.transform.parent = Globals.Instance.MGUIManager.MGUICamera.transform; _gobjCrit.transform.localScale = new Vector3(Globals.Instance.MGUIManager.widthRatio, Globals.Instance.MGUIManager.heightRatio, 1); // _gobjCrit.transform.localPosition = uiOffset + offset; PackedSprite effectFont = null; SpriteText textSkill = null; PackedSprite number = null; switch (type) { case EffectType.CRIT: // effectFont = GameObject.Instantiate(effectFontPreb) as PackedSprite; // effectFont.transform.parent = _gobjCrit.transform; // effectFont.transform.localPosition = new Vector3 (0, 0, 0); // effectFont.PlayAnim ("RedCrit"); // AnimateScale.Do (_gobjCrit, EZAnimation.ANIM_MODE.To, Vector3.one * 2, EZAnimation.linear, AnimScaleDurationTime, 0f, null, null); // FadeSpriteAlpha.Do (effectFont, EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.linear, AnimAlphaDurationTime, AnimAlphaDelayTime, null, DestroyEffectObj); break; case EffectType.DODGE: effectFont = GameObject.Instantiate(effectFontPreb) as PackedSprite; effectFont.transform.parent = _gobjCrit.transform; effectFont.transform.localPosition = new Vector3(0, 0, 0); effectFont.transform.localScale = Vector3.one; effectFont.PlayAnim("Shan"); AnimateScale.Do(_gobjCrit, EZAnimation.ANIM_MODE.To, Vector3.one * 2, EZAnimation.linear, AnimScaleDurationTime, 0f, null, null); FadeSpriteAlpha.Do(effectFont, EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.linear, AnimAlphaDurationTime, AnimAlphaDelayTime, null, DestroyEffectObj); break; case EffectType.SKILL: //delay = 0; //duration = 6; textSkill = GameObject.Instantiate(textSkillPreb) as SpriteText; textSkill.transform.parent = _gobjCrit.transform; textSkill.transform.localPosition = new Vector3(0, 0, 0); textSkill.transform.localScale = Vector3.one; textSkill.Text = skillName; //textSkill.SetColor(new Color32(255,129,54,255)); // textSkill.SetColor(new Color32(255,255,0,255)); textSkill.SeaColor = SeaClientColorType.DarkRed210000005; //textSkill.SetColor(Color.magenta); textSkill.SetCharacterSize(40); FadeText.Do(textSkill, EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.linear, AnimAlphaDurationTime, AnimAlphaDelayTime, null, DestroyEffectObj); break; case EffectType.CRIT_SKILL: //delay = 0; //duration = 6; // effectFont = GameObject.Instantiate(effectFontPreb) as PackedSprite; // effectFont.transform.parent = _gobjCrit.transform; // effectFont.transform.localPosition = new Vector3 (0, 20, 0); // effectFont.PlayAnim ("RedCrit"); // //DoAnimationFade (effectFont, DestroyEffectObj); // AnimateScale.Do (_gobjCrit, EZAnimation.ANIM_MODE.To, Vector3.one * 1.5f, EZAnimation.linear, AnimScaleDurationTime, 0f, null, null); // FadeSpriteAlpha.Do (effectFont, EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.linear, AnimAlphaDurationTime, AnimAlphaDelayTime, null, DestroyEffectObj); textSkill = GameObject.Instantiate(textSkillPreb) as SpriteText; textSkill.transform.parent = _gobjCrit.transform; textSkill.transform.localPosition = new Vector3(0, 0, 0); textSkill.transform.localScale = Vector3.one; textSkill.Text = skillName; // textSkill.SetColor(new Color32(255,255,0,255)); textSkill.SeaColor = SeaClientColorType.DarkRed210000005; //textSkill.SetColor(Color.magenta); textSkill.SetCharacterSize(40); FadeText.Do(textSkill, EZAnimation.ANIM_MODE.To, Color.clear, EZAnimation.linear, AnimAlphaDurationTime, AnimAlphaDelayTime, null, DestroyEffectObj); break; case EffectType.NUMBER_GRAY: this.PlayAttackNumber(type, "NumMinus", "NumRed", val); break; case EffectType.NUMBER_RED: this.PlayAttackNumber(type, "NumMinus", "NumRed", val); break; case EffectType.NUMBER_GREEN: this.PlayAttackNumber(type, "GreenPlus", "NumGreen", val); break; } if (type == EffectType.CRIT || type == EffectType.CRIT_SKILL || type == EffectType.NUMBER_RED) { iTween.ShakePosition(_gobjCrit, new Vector3(5, 5, 0), AnimAlphaDurationTime); // _gobjCrit.transform.localScale = new Vector3(2.5f,2.5f,1); } }
public void ShowEffect(EffectType effectType, Vector3 position, Quaternion rotation) { var effect = Instantiate(_effectsMap[effectType], position, rotation); }
private byte[] DoEffectAndUpdate(byte[] image, EffectType effect) { byte[] buffer = DoEffect(image, effect); return(buffer); }
public EffectType type; // The type of the effect #endregion #region Constructors public CardEffect(int newVal, EffectType newType) { val = newVal; type = newType; }
public AddOrRemoveCounter(EffectType et) : base(et) { }
private static Effect GetEffect(EffectType prim) { Effect eff = null; switch (prim) { case EffectType.Speed: eff = new Speed(); break; case EffectType.Slowness: eff = new Slowness(); break; case EffectType.Haste: eff = new Haste(); break; case EffectType.MiningFatigue: eff = new MiningFatigue(); break; case EffectType.Strength: eff = new Strength(); break; case EffectType.InstantHealth: eff = new InstantHealth(); break; case EffectType.InstantDamage: eff = new InstantDamage(); break; case EffectType.JumpBoost: eff = new JumpBoost(); break; case EffectType.Nausea: eff = new Nausea(); break; case EffectType.Regeneration: eff = new Regeneration(); break; case EffectType.Resistance: eff = new Resistance(); break; case EffectType.FireResistance: eff = new FireResistance(); break; case EffectType.WaterBreathing: eff = new WaterBreathing(); break; case EffectType.Invisibility: eff = new Invisibility(); break; case EffectType.Blindness: eff = new Blindness(); break; case EffectType.NightVision: eff = new NightVision(); break; case EffectType.Hunger: eff = new Hunger(); break; case EffectType.Weakness: eff = new Weakness(); break; case EffectType.Poison: eff = new Poison(); break; case EffectType.Wither: eff = new Wither(); break; case EffectType.HealthBoost: eff = new HealthBoost(); break; case EffectType.Absorption: eff = new Absorption(); break; case EffectType.Saturation: eff = new Saturation(); break; } return(eff); }
public AddOrRemoveCounter(EffectType et, IntegerValue amount) : base(et) { Amount = amount; }
static void Main(string[] args) { Utility.WriteExeDetails(); Utility.LoadStrings(root); Utility.LoadClientNpcs(root); Utility.LoadItems(root); Utility.LoadSkills(root); Utility.LoadSkillLearns(root); Utility.LoadUltraSkills(root); string outputPath = Path.Combine(root, @".\output"); if (!Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); } var outputFile = new SkillData(); var settings = new XmlWriterSettings() { CheckCharacters = false, CloseOutput = false, Indent = true, IndentChars = "\t", NewLineChars = "\n", Encoding = new UTF8Encoding(false) }; #region Pet UltraSkill parsing PetSkillTemplates petTemplates = new PetSkillTemplates(); List <PetSkill> ultraSkills = new List <PetSkill>(); foreach (var ultra in Utility.UltraSkillIndex.UltraSkillList) { PetSkill petSkill = new PetSkill(); petSkill.skill_id = Utility.SkillIndex[ultra.ultra_skill].id; if (String.Compare("Light_Summon_MagmaElemental_G1", ultra.pet_name) == 0) { ultra.pet_name = "Dark_Summon_MagmaElemental_G1"; } else if (String.Compare("Dark_Summon_TempestElemental_G1", ultra.pet_name) == 0) { ultra.pet_name = "Light_Summon_TempestElemental_G1"; } petSkill.pet_id = Utility.ClientNpcIndex[ultra.pet_name]; if (petSkill.pet_id == -1) { petSkill.missing_pet_id = ultra.pet_name; petSkill.pet_id = 0; } ClientSkill skill = Utility.SkillIndex[ultra.order_skill]; if (skill != null) { petSkill.order_skill = Utility.SkillIndex[ultra.order_skill].id; } //else // petSkill.missing_order_skill = ultra.order_skill; ultraSkills.Add(petSkill); } petTemplates.SkillList = ultraSkills.OrderBy(s => s.skill_id).ToList(); try { using (var fs = new FileStream(Path.Combine(outputPath, "pet_skills.xml"), FileMode.Create, FileAccess.Write)) using (var writer = XmlWriter.Create(fs, settings)) { XmlSerializer ser = new XmlSerializer(typeof(PetSkillTemplates)); ser.Serialize(writer, petTemplates); } } catch (Exception ex) { Debug.Print(ex.ToString()); } #endregion /* Old * var skillsetEx = new Dictionary<int, int>() { * { 1566, 1564 }, { 1586, 1564 }, { 2210, 1564 }, { 1574, 1564 }, { 1575, 1564 }, { 1576, 1564 }, * { 1596, 1564 }, { 1564, 1564 }, { 1565, 1564 }, { 1590, 1564 }, * { 1554, 1554 }, { 1588, 1554 }, * { 969, 969 }, { 970, 969 }, { 971, 969 }, { 989, 969 }, { 2181, 969 }, { 1220, 969 }, * { 1221, 969 }, { 1222, 969 }, { 1267, 969 }, { 1318, 969 }, { 1319, 969 }, { 1342, 969 }, * { 2183, 969 }, * { 1105, 1105 }, { 1107, 1105 }, { 1108, 1105 }, { 1187, 1105 }, { 1112, 1105 }, { 1186, 1105 } * }; */ // skillset_exception == client_skills.delay_id (All client skills have delay id but skills on same cooldown/exception list have the same delay id) var skillsetEx2 = new Dictionary <int, int>() { { 1564, 2 }, { 1565, 2 }, { 1566, 2 }, { 1574, 2 }, { 1575, 2 }, { 1586, 2 }, { 1590, 2 }, { 1596, 2 }, { 2210, 2 }, { 1105, 4 }, { 1107, 4 }, { 1108, 4 }, { 1112, 4 }, { 1186, 4 }, { 1187, 4 }, { 969, 5 }, { 970, 5 }, { 971, 5 }, { 989, 5 }, { 1220, 5 }, { 1221, 5 }, { 1222, 5 }, { 1267, 5 }, { 1318, 5 }, { 1319, 5 }, { 1342, 5 }, { 2181, 5 }, { 2183, 5 }, { 540, 6 }, { 1636, 6 }, { 1637, 6 }, { 1685, 6 }, { 1708, 6 }, { 1781, 6 }, { 1782, 6 }, { 1935, 6 }, { 2008, 6 }, { 2062, 6 }, { 2231, 6 }, { 2232, 6 }, { 8345, 6 }, { 173, 7 }, { 524, 7 }, { 1554, 8 }, { 1555, 8 }, { 1556, 8 }, { 1587, 8 }, { 1588, 8 }, { 955, 9 }, { 956, 9 }, { 957, 9 }, { 986, 9 }, { 1230, 9 }, { 2159, 9 }, { 2165, 9 }, { 2178, 9 }, { 559, 175 }, { 582, 175 }, { 851, 175 }, { 858, 175 }, { 948, 175 }, { 646, 2005 }, { 684, 2005 }, { 693, 2005 }, { 694, 2005 }, { 776, 2005 }, { 777, 2005 }, { 786, 2005 }, { 2075, 2005 } }; // Limit skills with same delay_id to a max # of occurances var skillset_maxoccurs = new Dictionary <int, int>() { { 646, 2 }, { 684, 2 }, { 693, 2 }, { 776, 2 }, { 777, 2 }, { 786, 2 }, { 2075, 2 } }; var delayIdOverrides = new Dictionary <int, int>() { { 11885, 11885 }, { 11886, 11885 }, { 11887, 11885 }, { 11888, 11885 }, { 11889, 11885 }, { 11890, 11890 }, { 11891, 11890 }, { 11892, 11890 }, { 11893, 11890 }, { 11894, 11890 } }; // skills which have 0 cast time or cooldown is smaller and which exclude each other var delayIdsForSkills = new Dictionary <int, int>() { { 1178, 1178 }, { 2148, 1178 }, { 1177, 1178 }, { 2147, 1178 } }; #region Finding the chainDelayIdsInclude //Dictionary<int, int> diffDelays = Utility.SkillIndex.SkillList.ToDictionary(s => s.id, s => s.delay_id); //Dictionary<int, bool> diffCount = diffDelays.Values.GroupBy(x => x).ToDictionary(x => x.Key, g => g.Count() > 1); /* * //test lookups * int skill_id = 2075; //known to have listed exception * int delay_id = 2005; //delay id associated with client skill * * if (diffCount.ContainsKey(delay_id) && diffCount[delay_id]) { * int skill_exception_test = diffDelays[skill_id]; * } */ /* * var diffDelays = Utility.SkillIndex.SkillList.Where(s => s.delay_id > 0 && * s.sub_type == SkillSubType.buff && * s.chain_category_level > 0) * .ToLookup(s => s.delay_id, s => s); * var chainCategories = new Dictionary<string, List<ClientSkill>>(); * * foreach (var group in diffDelays) { * var skills = diffDelays[group.Key]; * string[] chains = skills.Select(s => s.chain_category_priority).Distinct().ToArray(); * string categoryName = chains.Where(s => s != null).FirstOrDefault(); * if (categoryName == null) { * chains = skills.Select(s => s.prechain_skillname).Distinct().ToArray(); * categoryName = chains.Where(s => s != null).FirstOrDefault(); * } * * if (categoryName == null) * continue; * * if (chainCategories.ContainsKey(categoryName)) { * Debug.Print("Different delay id for chain: {0}", categoryName); * chainCategories[categoryName].AddRange(skills.ToList()); * } else { * chainCategories.Add(categoryName, skills.ToList()); * } * } * * chainCategories = chainCategories.Where(pair => pair.Value.Count > 1) * .OrderBy(p => p.Value.First().delay_id) * .ToDictionary(pair => pair.Key, pair => pair.Value); * * // StringBuilder sb = new StringBuilder(); * foreach (var pair in chainCategories) { * // sb.AppendFormat("SkillSet by delay: {0}\r\n", pair.Key); * foreach (var skill in pair.Value) { * // string desc = Utility.StringIndex.GetString(skill.desc); * if (skill.casting_delay == 0) { * int dur = 0; * if (skill.effect1_reserved_cond1 == null || * skill.effect1_reserved_cond1_prob2 == 100 && * skill.effect1_reserved_cond1 == "EveryHit") * dur = Math.Max(dur, skill.effect1_remain2); * if (skill.effect2_reserved_cond1 == null || * skill.effect2_reserved_cond1_prob2 == 100 && * skill.effect2_reserved_cond1 == "EveryHit") * dur = Math.Max(dur, skill.effect2_remain2); * if (skill.effect3_reserved_cond1 == null || * skill.effect3_reserved_cond1_prob2 == 100 && * skill.effect3_reserved_cond1 == "EveryHit") * dur = Math.Max(dur, skill.effect3_remain2); * if (skill.effect4_reserved_cond1 == null || * skill.effect4_reserved_cond1_prob2 == 100 && * skill.effect4_reserved_cond1 == "EveryHit") * dur = Math.Max(dur, skill.effect4_remain2); * skill.casting_delay = dur; * } * * if (skill.casting_delay == 0 || skill.casting_delay / 1000 > skill.delay_time / 100) { * sb.AppendFormat("\tSkill: id={0}; name={1}; delayId={2}; r10={3}/{4}/{5}/{6}; delay={7}; cooldown={8}\r\n", * skill.id, desc, * skill.delay_id, skill.effect1_reserved10, skill.effect2_reserved10, * skill.effect3_reserved10, skill.effect4_reserved10, * skill.casting_delay, skill.delay_time / 100); * } * } * } */ #endregion Dictionary <ClientSkill, List <ClientEffect> > list = new Dictionary <ClientSkill, List <ClientEffect> >(); Dictionary <string, HashSet <string> > statData = new Dictionary <string, HashSet <string> >(); const EffectType filterEffect = EffectType.None; const Stat filterStat = Stat.None; StringBuilder sb = new StringBuilder(); //for (var filterEffect = EffectType.None + 1; // filterEffect <= EffectType.XPBoost; filterEffect++) { foreach (var sk in Utility.SkillIndex.SkillList) { var template = new SkillTemplate(); template.skill_id = sk.id; template.name = sk.desc; // Check Skill Strings for Name ID template.nameId = Utility.StringIndex[sk.desc.ToUpper()] * 2 + 1; // SKill Name ID is Not in Skill Strings, Check Item Stings if (template.nameId == -1) { template.nameId = Utility.StringIndex[sk.desc.ToUpper()] * 2 + 1; } // SKill Name ID is Not in Item Strings, Check Main Strings if (template.nameId == -1) { template.nameId = Utility.StringIndex[sk.desc.ToUpper()] * 2 + 1; } // SKill Name ID is Not in General Strings, Check UI Strings if (template.nameId == -1) { template.nameId = Utility.StringIndex[sk.desc.ToUpper()] * 2 + 1; } string stack; int level = -1; if (level == -1) { level = Utility.GetSkillLevelFromName(sk.name, out stack); } //if (level == -1 && !String.IsNullOrEmpty(sk.skillicon_name)) // level = Utility.GetSkillLevelFromName(sk.skillicon_name, out stack); if (level == -1) { level = 1; } template.lvl = level; level = Utility.GetSkillLevelFromName(sk.desc, out stack); template.stack = stack.ToUpper(); // some overides for stack. if (sk.id == 251 || sk.id == 258 || sk.id == 385) { template.stack = "SKILL_GL_251_258_385"; } template.skilltype = (skillType)sk.type; template.skillsubtype = (skillSubType)sk.sub_type; template.tslot = (TargetSlot)sk.target_slot; template.tslot_level = sk.target_slot_level; template.activation = (activationAttribute)sk.activation_attribute; template.cooldown = sk.delay_time / 100; template.cancel_rate = sk.cancel_rate; if (sk.casting_delay > 0) { template.duration = sk.casting_delay; } template.pvp_duration = sk.pvp_remain_time_ratio; template.chain_skill_prob = sk.chain_skill_prob1 == 0 && sk.chain_skill_prob2 != 0 ? sk.chain_skill_prob2 : 0; //template.dispel_category = sk.dispel_category.ToString().ToUpper(); template.dispel_category = sk.getDispellCategory(); //template.dispel_level = sk.required_dispel_level; //template.delay_id = sk.delay_id; if (!String.IsNullOrEmpty(sk.penalty_skill_succ)) { var penaltySkill = Utility.SkillIndex[sk.penalty_skill_succ]; if (penaltySkill == null) { Debug.Print("Missing penalty skill: {0}", sk.penalty_skill_succ); } else { template.penalty_skill_id = penaltySkill.id; } } if (sk.change_stance != Stance.none) { template.stance = true; } template.pvp_damage = sk.pvp_damage_ratio; if (sk.first_target != FirstTarget.None) { //template.setproperties = new Properties(); var properties = new Properties(); properties.firsttarget = new FirstTargetProperty(); properties.firsttarget.value = (FirstTargetAttribute)sk.first_target; if (sk.first_target_valid_distance > 0) { properties.firsttargetrange = new FirstTargetRangeProperty(); properties.firsttargetrange.value = sk.first_target_valid_distance; properties.firsttargetrange.valueSpecified = true; } //else if (sk.first_target == FirstTarget.Target) // properties.firsttargetrange = new FirstTargetRangeProperty(); if (sk.target_range != TargetRange.None) { properties.target_range = new TargetRangeProperty(); if (sk.target_range_opt1 != 0) { properties.target_range.distance = sk.target_range_opt1; properties.target_range.distanceSpecified = true; } if (sk.target_maxcount != 0) { properties.target_range.maxcount = sk.target_maxcount; properties.target_range.maxcountSpecified = true; } if (sk.target_range != TargetRange.None) { properties.target_range.value = (TargetRangeAttribute)sk.target_range; } } if (sk.target_relation_restriction != RelationRestriction.None) { properties.targetrelation = new TargetRelationProperty(); properties.targetrelation.value = (TargetRelationAttribute)sk.target_relation_restriction; } if (sk.target_species_restriction != SpeciesRestriction.None) { properties.targetspecies = new TargetSpeciesProperty(); properties.targetspecies.value = (TargetSpeciesAttribute)sk.target_species_restriction; } var importUtil = Utility <ClientSkill> .Instance; List <string> states = new List <string>(); importUtil.Export <string>(sk, "target_valid_status", states); TargetState state = 0; foreach (string s in states) { try { TargetState s1 = (TargetState)Enum.Parse(typeof(TargetState), s, true); state |= s1; } catch (Exception e) { } } //if (state != TargetState.NONE) //{ // states = states.ConvertAll(s => s.ToUpper()); // List<TargetStatusProperty> statusProperties = states.ConvertAll(s => { TargetStatusProperty t = new TargetStatusProperty(); t.value = s; return t; }); // properties.targetstatus = statusProperties; //} if (sk.add_wpn_range) { template.initproperties = new Properties(); template.initproperties.addweaponrange = new AddWeaponRangeProperty(); } template.setproperties = properties; } template.useconditions = new Conditions(); template.startconditions = new Conditions(); template.actions = new Actions(); List <Condition> useList = new List <Condition>(); List <Condition> useEquipmentConditionsList = new List <Condition>(); List <Condition> startList = new List <Condition>(); List <Action> actionList = new List <Action>(); //TargetFlyingCondition targetflyingcondition = null; TargetCondition targetcondition = null; /* * if (sk.target_species_restriction != SpeciesRestriction.None && sk.target_species_restriction != SpeciesRestriction.All) * { * targetcondition = new TargetCondition((FlyingRestriction)sk.target_species_restriction); * startList.Add(targetcondition); * }*/ /* * if (sk.required_leftweapon != LeftWeapon.None) * { * useEquipmentConditionsList.Add(new ArmorCondition(sk.required_leftweapon.ToString().ToUpper())); * } */ // Periodic Actions if (sk.cost_checktime > 0 || sk.cost_toggle > 0) { PeriodicAction periodicAction = new PeriodicAction(); CostType parameter = sk.cost_checktime_parameter; if (parameter == CostType.NONE) { parameter = sk.cost_parameter; } if (parameter == CostType.MP || parameter == CostType.MP_RATIO) { var mpUseAction = new MpUseAction(); periodicAction.checktime = sk.cost_time; mpUseAction.percent = parameter == CostType.MP_RATIO; if (sk.cost_checktime_lv > 0 || sk.cost_checktime > 0) { mpUseAction.value = sk.cost_checktime; mpUseAction.delta = sk.cost_checktime_lv; } else if (sk.cost_toggle_lv > 0 || sk.cost_toggle > 0) { mpUseAction.value = sk.cost_toggle; mpUseAction.delta = sk.cost_toggle_lv; } periodicAction.mpuse = mpUseAction; } else if (parameter == CostType.HP || parameter == CostType.HP_RATIO) { var hpUseAction = new HpUseAction(); periodicAction.checktime = sk.cost_time; hpUseAction.percent = parameter == CostType.HP_RATIO; if (sk.cost_checktime_lv > 0 || sk.cost_checktime > 0) { hpUseAction.value = sk.cost_checktime; hpUseAction.delta = sk.cost_checktime_lv; } else if (sk.cost_toggle_lv > 0 || sk.cost_toggle > 0) { hpUseAction.value = sk.cost_toggle; hpUseAction.delta = sk.cost_toggle_lv; } periodicAction.hpuse = hpUseAction; } //template.periodicactions = periodicAction; } else { // Non Periodic Actions if (sk.cost_parameter != CostType.NONE && sk.cost_checktime == 0) { CostType parameter = sk.cost_checktime_parameter; if (parameter == CostType.NONE) { parameter = sk.cost_parameter; } if (parameter == CostType.MP || parameter == CostType.MP_RATIO) { var mpUseAction = new MpUseAction(); mpUseAction.percent = parameter == CostType.MP_RATIO; if (sk.cost_end > 0 || sk.cost_end_lv > 0) { mpUseAction.value = sk.cost_end; mpUseAction.delta = sk.cost_end_lv; actionList.Add(mpUseAction); } else if (sk.cost_toggle_lv > 0 || sk.cost_toggle > 0) { mpUseAction.value = sk.cost_toggle; mpUseAction.delta = sk.cost_toggle_lv; actionList.Add(mpUseAction); } } else if (parameter == CostType.HP || parameter == CostType.HP_RATIO) { var hpUseAction = new HpUseAction(); hpUseAction.percent = parameter == CostType.HP_RATIO; if (sk.cost_end > 0 || sk.cost_end_lv > 0) { hpUseAction.value = sk.cost_end; hpUseAction.delta = sk.cost_end_lv; actionList.Add(hpUseAction); } else if (sk.cost_toggle_lv > 0 || sk.cost_toggle > 0) { hpUseAction.value = sk.cost_toggle; hpUseAction.delta = sk.cost_toggle_lv; actionList.Add(hpUseAction); } } } } if (sk.cost_end != 0) { startList.Add(new MpCondition(sk.cost_end, sk.cost_end_lv)); } /* * if (sk.required_leftweapon != LeftWeapon.None) * { * startList.Add(new ArmorCondition(sk.required_leftweapon.ToString().ToUpper())); * }*/ if (sk.use_arrow != null && sk.use_arrow != "0") { // 3 arena skills have FX_pow, FX_HIT and weaponbody startList.Add(new ArrowCheckCondition()); } else { if (sk.use_arrow_count != 0) { startList.Add(new ArrowCheckCondition()); } } if (sk.cost_dp > 0) { startList.Add(new DpCondition(sk.cost_dp)); actionList.Add(new DpUseAction(sk.cost_dp, sk.cost_dp_lv)); } /* * string required_weapons = getRequiredWeapons(sk); * if (required_weapons != null) * { * startList.Add(new WeaponCondition(required_weapons)); * } * * // Target Flying Start Condition * FlyRestriction restriction = (FlyRestriction)sk.target_flying_restriction; * if (restriction != FlyRestriction.NONE) * { * if (targetflyingcondition == null) * startList.Add(new TargetFlyingCondition(restriction)); * else * targetflyingcondition.restriction = restriction; * } * * if (sk.chain_category_name != null) * { * ChainCondition chain = new ChainCondition(); * chain.category = sk.chain_category_name.ToUpper(); * * if (sk.prechain_category_name != null) chain.precategory = sk.prechain_category_name.ToUpper(); * if (sk.chain_time != null) chain.time = Int32.Parse(sk.chain_time); * * startList.Add(chain); * } */ // Self Flying Start Condition /* * restriction = (FlyRestriction)sk.self_flying_restriction; * if (restriction != FlyRestriction.NONE) * startList.Add(new SelfCondition(restriction)); * * if (sk.nouse_combat_state == 1) * { * startList.Add(new CombatCheckCondition()); * } */ if (sk.component != null) { Item item = Utility.ItemIndex.GetItem(sk.component); if (item == null) { Debug.Print("Missing item for skill {0}", sk.id); } else { actionList.Add(new ItemUseAction(item.id, sk.component_count)); } } if (!sk.move_casting) { useList.Add(new PlayerMovedCondition(false)); } #region Fill conditions and actions // Use Conditions if (useList.Count == 0) { template.useconditions = null; } else { template.useconditions.ConditionList = useList; } // Start Conditions if (startList.Count == 0) { template.startconditions = null; } else { template.startconditions.ConditionList = startList; } // Skill Actions if (actionList.Count == 0) { template.actions = null; } else { template.actions.ActionList = actionList; } #endregion if (skillsetEx2.ContainsKey(sk.id)) { template.skillset_exception = skillsetEx2[sk.id]; } /* * if (sk.delay_id != 0) * template.skillset_exception = diffCount.ContainsKey(sk.delay_id) && diffCount[sk.delay_id] == true ? diffDelays[sk.id] : 0; */ //if (delayIdsForSkills.ContainsKey(sk.id)) //{ // template.delay_id = delayIdsForSkills[sk.id]; //} //else if (delayIdOverrides.ContainsKey(sk.id)) //{ // template.delay_id = delayIdOverrides[sk.id]; //} string descrStr = sk.desc_long == null ? sk.desc : sk.desc_long; var desc = Utility.StringIndex.GetStringDescription(descrStr); string desc_2nd; if (!String.IsNullOrEmpty(sk.desc_long_2nd)) { desc_2nd = Utility.StringIndex.GetStringDescription(sk.desc_long_2nd).body; } if (sk.motion_name != ClientMotion.None) { Motion motion = new Motion(); motion.name = sk.motion_name != ClientMotion.None ? sk.motion_name.ToString().ToLower() : null; motion.instant_skill = sk.instant_skill != null && sk.instant_skill == "1" ? true : false; motion.speed = sk.motion_play_speed != 0 && sk.motion_play_speed != 100 ? sk.motion_play_speed : 0; template.motion = motion; } #region Effect processing var utility = Utility <ClientSkill> .Instance; List <ClientEffect> effects = new List <ClientEffect>(); utility.Export(sk, "effect", effects); var validEffects = effects.Where(e => e.type != EffectType.None).ToArray(); bool save = validEffects.Where(e => e.type == filterEffect).Any(); // var validEffects = effects.Where(e => e.changeStat != Stat.None).ToArray(); // bool save = validEffects.Where(e => e.changeStat == filterStat).Any(); string text = desc == null ? String.Empty : desc.body; int idx = 0; var vars = (from v in Utility.GetVarStrings(text) let parts = v.Split('.') let parsed = Int32.TryParse(parts[0].Remove(0, 1), out idx) let name = parsed ? parts[1] : v let var = parsed ? parts[2] : String.Empty select new { Id = idx, Data = new StatData(name, var) }) .ToLookup(a => a.Id, a => a); if (save) { sb.Append("\r\n"); sb.AppendFormat("---Skill Id = {0}, Name = '{1}' ---\r\n", sk.id, Utility.StringIndex.GetString(sk.desc)); if (desc == null) { sb.AppendFormat("NO DESCRIPTION\r\n"); } else { sb.AppendFormat("{0}: {1}\r\n", desc.name, desc.body); } if (sk.desc_abnormal != null) { sb.AppendFormat("ABNORMAL: {0}\r\n", Utility.StringIndex.GetString(sk.desc_abnormal)); } } foreach (var eff in validEffects) { EffectClass @class = (EffectClass)eff.type; #region Overrides #endregion Type type = effectsAssembly.GetType(String.Format("{0}.{1}", typeof(Effect).Namespace, @class.ToString())); Effect ourEffect = null; if (save) { sb.AppendFormat("Data for {0}:\r\n", @class); } if (vars.Any()) { if (vars.Contains(idx + 1)) { foreach (var v in vars[idx + 1]) { if (!statData.ContainsKey(v.Data.Name)) { statData.Add(v.Data.Name, new HashSet <string>()); } statData[v.Data.Name].Add(v.Data.Var); if (save) { sb.AppendFormat("\tEffect = {0}, Var = {1}\r\n", v.Data.Name, v.Data.Var); } } } } if (save) { sb.AppendFormat("\tE{0} Reserved: ", eff.e); using (TextWriter wr = new StringWriter(sb)) { ObjectDumper.Write(eff.reserved, wr); sb.Append("\r\n"); if (!String.IsNullOrEmpty(eff.reserved_cond1)) { sb.AppendFormat("\tCondition = {0}, Prob. = ", eff.reserved_cond1); ObjectDumper.Write(eff.reserved_cond1_prob, wr); sb.Append("\r\n"); } if (!String.IsNullOrEmpty(eff.reserved_cond2)) { sb.AppendFormat("\tCondition = {0}, Prob. = ", eff.reserved_cond2); ObjectDumper.Write(eff.reserved_cond2_prob, wr); sb.Append("\r\n"); } } } if (type == null) { string skillName = Utility.StringIndex.GetString(sk.desc); Debug.Print("Effect {0} not handled (skillId={1}; name='{2}')", @class, sk.id, skillName); continue; } else { ourEffect = (Effect)Activator.CreateInstance(type); } if (template.effects == null) { template.effects = new Effects();/* * if (sk.skillicon_name != null) * template.effects.food = sk.skillicon_name.EndsWith("_food"); */ } eff.Skill = sk; eff.Template = template; ourEffect.Import(eff, null); template.effects.EffectList.Add(ourEffect); } #endregion //if (template.effects != null && template.effects.EffectList != null) { // if (template.effects.EffectList.Count == 0) // template.effects.EffectList = null; // else if (template.activation != activationAttribute.PASSIVE) { // foreach (var eff in template.effects.EffectList) { // if (eff is DeformEffect || eff is PolymorphEffect || eff is ShapeChangeEffect || // eff is WeaponDualEffect) { // } else // eff.basiclvl = 0; // not used for active skills // } // } //} if (template.effects != null && template.effects.EffectList == null) { template.effects = null; } outputFile.SkillList.Add(template); if (filterEffect != EffectType.None) { string fileName = /*"stat_" + filterStat*/ filterEffect.ToString() + ".txt"; using (var fs = new FileStream(Path.Combine(outputPath, fileName), FileMode.Create, FileAccess.Write)) { using (TextWriter wr = new StreamWriter(fs)) { wr.Write(sb.ToString()); } } } sb.Length = 0; } try { using (var fs = new FileStream(Path.Combine(outputPath, "skill_templates.xml"), FileMode.Create, FileAccess.Write)) using (var writer = XmlWriter.Create(fs, settings)) { XmlSerializer ser = new XmlSerializer(typeof(SkillData)); ser.UnknownAttribute += new XmlAttributeEventHandler(OnUnknownAttribute); ser.UnknownElement += new XmlElementEventHandler(OnUnknownElement); ser.Serialize(writer, outputFile); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } Console.WriteLine("Process completed"); Console.Read(); }
//---------------------------------------------------------------------- // Here we do the actual work of studying tiles to see if they are suitable // for spawn; if something is wrong with the spawn finder, it's probably // here //---------------------------------------------------------------------- private static bool FindSpawnTileInternal( PlayerMobile pm, Point3D centerPoint, Point2D currentPoint, ref Point3D spawnPoint, LandType landType, EffectType effectType, int effectHue ) { Map map = pm.Map; Region sourceRegion = pm.Region; LandTile landTile = map.Tiles.GetLandTile(centerPoint.X, centerPoint.Y); LandTile spawnTile = map.Tiles.GetLandTile(currentPoint.X, currentPoint.Y); StaticTile[] staticTiles = map.Tiles.GetStaticTiles(currentPoint.X, currentPoint.Y, true); Region r = Region.Find(new Point3D(currentPoint.X, currentPoint.Y, landTile.Z), map); if (r.GetType() != sourceRegion.GetType()) { //Console.WriteLine( "player.Location="+pm.Location ); //Console.WriteLine( "rquery={0},{1}", currentPoint.X, currentPoint.Y ); //Console.WriteLine( "sourceRegion="+sourceRegion.GetType() ); //Console.WriteLine( "r="+r.GetType() ); return(false); } if (r is HouseRegion) { return(false); } //-------------------------------------------------------------- // WATER LOCATION: //-------------------------------------------------------------- if ((TileData.LandTable[spawnTile.ID & 0x3FFF].Flags & TileFlag.Wet) == TileFlag.Wet) { if (landType != LandType.Water) { return(false); // water tile, isn't a water encounter } //---------------------------------------------------------- // Instead of the CanSpawn function we use can fit, as it allows us to not require // a surface (which defaults to true otherwise) //---------------------------------------------------------- if (map.CanFit(currentPoint.X, currentPoint.Y, spawnTile.Z, 16, true, true, false)) { spawnPoint.X = currentPoint.X; spawnPoint.Y = currentPoint.Y; spawnPoint.Z = spawnTile.Z; return(true); } //---------------------------------------------------------- // XXX -- note; there is a degenerate case where the static and not the land tile // determines water. This is along coastlines, and in rivers and the like; // may be useful later, as we can take "Wet" cells to generally be "at sea". // For now, though, we are ignoring these static wet tiles. One reason for // this is that if we don't we could end up getting dolphins in small // inland lakes. //---------------------------------------------------------- } //-------------------------------------------------------------- // LAND LOCATION: //-------------------------------------------------------------- else { if (landType == LandType.Water) { return(false); // land tile, isn't a land encounter } // search for wet static tiles; these are coastal cells; // if we we want land, we don't want to spawn in cells like these: bool foundWet = false; foreach (StaticTile staticTile in staticTiles) { if ((TileData.ItemTable[staticTile.ID].Flags & TileFlag.Wet) == TileFlag.Wet) { foundWet = true; break; } } if (foundWet) { return(false); } //if( RandomEncounterEngine.DebugEffect ) //Effects.SendLocationParticles( //EffectItem.Create( new Point3D( currentPoint.X, currentPoint.Y, centerPoint.Z), map, EffectItem.DefaultDuration ), //0x37CC, 1, 40, 36, 3, 9917, 0 //); // we will probe highest to lowest if the player is above ground level (e.g, they are in a tower), // or lowest to highest otherwise: ArrayList staticTileArray = new ArrayList(staticTiles); staticTileArray.Sort(new TileComparer()); if (centerPoint.Z > landTile.Z) { staticTileArray.Reverse(); } foreach (StaticTile staticTile in staticTileArray) { if (map.CanSpawnMobile(currentPoint.X, currentPoint.Y, staticTile.Z)) { spawnPoint.X = currentPoint.X; spawnPoint.Y = currentPoint.Y; spawnPoint.Z = staticTile.Z; if (RandomEncounterEngine.DebugEffect) { Effects.SendLocationParticles( EffectItem.Create(new Point3D(spawnPoint.X, spawnPoint.Y, spawnPoint.Z), map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 96, 3, 9917, 0 ); } else if (effectType != EffectType.None) { EffectEntry effect = EffectEntry.Lookup[(int)effectType]; Effects.SendLocationParticles( EffectItem.Create(new Point3D(spawnPoint.X, spawnPoint.Y, spawnPoint.Z), map, EffectItem.DefaultDuration), effect.Animation, effect.Speed, effect.Duration, effectHue, effect.RenderMode, effect.Effect, 0 ); } //Console.WriteLine("Found good point at static.Z"); return(true); } //if( RandomEncounterEngine.DebugEffect ) //Effects.SendLocationParticles( //EffectItem.Create( new Point3D( currentPoint.X, currentPoint.Y, staticTile.Z), map, EffectItem.DefaultDuration ), //0x37CC, 1, 40, 36, 3, 9917, 0 //); } // probe spawn tile Z if (map.CanSpawnMobile(currentPoint.X, currentPoint.Y, spawnTile.Z)) { spawnPoint.X = currentPoint.X; spawnPoint.Y = currentPoint.Y; spawnPoint.Z = spawnTile.Z; if (RandomEncounterEngine.DebugEffect) { Effects.SendLocationParticles( EffectItem.Create(new Point3D(spawnPoint.X, spawnPoint.Y, spawnPoint.Z), map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 36, 3, 9917, 0 ); } else if (effectType != EffectType.None) { EffectEntry effect = EffectEntry.Lookup[(int)effectType]; Effects.SendLocationParticles( EffectItem.Create(new Point3D(spawnPoint.X, spawnPoint.Y, spawnPoint.Z), map, EffectItem.DefaultDuration), effect.Animation, effect.Speed, effect.Duration, effectHue, effect.RenderMode, effect.Effect, 0 ); } //Console.WriteLine("Found good point at search point.Z"); return(true); } // probe player tile Z if (map.CanSpawnMobile(currentPoint.X, currentPoint.Y, centerPoint.Z)) { spawnPoint.X = currentPoint.X; spawnPoint.Y = currentPoint.Y; spawnPoint.Z = centerPoint.Z; if (RandomEncounterEngine.DebugEffect) { Effects.SendLocationParticles( EffectItem.Create(new Point3D(spawnPoint.X, spawnPoint.Y, spawnPoint.Z), map, EffectItem.DefaultDuration), 0x37CC, 1, 40, 167, 3, 9917, 0 ); } else if (effectType != EffectType.None) { EffectEntry effect = EffectEntry.Lookup[(int)effectType]; Effects.SendLocationParticles( EffectItem.Create(new Point3D(spawnPoint.X, spawnPoint.Y, spawnPoint.Z), map, EffectItem.DefaultDuration), effect.Animation, effect.Speed, effect.Duration, effectHue, effect.RenderMode, effect.Effect, 0 ); } //Console.WriteLine("Found good point at center point.Z"); return(true); } //if( RandomEncounterEngine.DebugEffect ) //Effects.SendLocationParticles( //EffectItem.Create( new Point3D( currentPoint.X, currentPoint.Y, spawnTile.Z), map, EffectItem.DefaultDuration ), //0x37CC, 1, 40, 36, 3, 9917, 0 //); } return(false); }
public RuntimeEffect(Effect effect) { this.Type = effect.Type; this.Magnitude = effect.Magnitude; this.Duration = effect.Duration; }
public bool DidEffectProc(EffectType effectType, int avoidance) { float chance = effectData[effectType].Chance; return(Helpers.RollChance((chance - avoidance) / 100f)); }
//regardless of how the child normally triggers, we only want it to fire when this attacks. public override bool triggersAs(EffectType triggerType) { return(triggerType == EffectType.attack || triggerType == EffectType.meta); }
public void ApplyEffectToTarget(Actor target, EffectType effectType, float effectPower) { ActorEffect.ApplyEffectToTarget(target, SourceActor, effectType, effectPower, effectData[effectType].Duration); }
//regardless of how the inner effect normally triggers, we want it to fire once every round. We need to keep the triggertype == EffectType.meta so we dont break EffectData.cloneEffect() public override bool triggersAs(EffectType triggerType) { return((triggerType == EffectType.everyRound) || (triggerType == EffectType.meta)); }
/// <summary> /// Initializes a new instance of the <see cref="UnitColorEffect"/> class. /// </summary> /// <param name="color">Color.</param> /// <param name="turns">Turns.</param> public UnitColorEffect(Color color, int turns, EffectType incomingEffectType = EffectType.TEMPORARY) { _color = color; _turns = turns; effectType = incomingEffectType; }
} //always trigger inner effect //allow this to trigger as an onDamage effect even if the child does not public override bool triggersAs(EffectType triggerType) { return(triggerType == EffectType.enemyDamaged || base.triggersAs(triggerType)); }
public Effect(EffectType type, float time, float value) { this.type = type; this.timeLeft = time; this.value = value; }
} //always trigger inner effect //allow this to trigger as an onDamage effect even if the child does not public override bool triggersAs(EffectType triggerType) { return(triggerType == EffectType.periodic || base.triggersAs(triggerType)); }
public void AddEffect(EffectType type, float time) { effects.Add(new Effect(type, time)); UpdateFlags(); }