public void onAction(ActionList _actions ,float _delay = 0f, bool _randPitch = false, float _everyX = 2f ) { switch (_actions) { case (ActionList.GettingHit) : { break; } case (ActionList.Healing) : { break; } case (ActionList.Jumping) : { break; } case (ActionList.Shooting) : { break; } case (ActionList.Walking) : { break; } default : { Debug.LogError("Default switch on action triggered"); break; } } }
public Filter() { Label = String.Empty; CanAbortProcessing = false; Conditions = new ConditionExpression(); Actions = new ActionList(); }
public Stunned(ActionList ownerList, Actor owner) { this.ownerList = ownerList; this.owner = owner; duration = 3/12f; isBlocking = true; }
private void Actor_Spawn(object sender, SpawnEventArgs e) { Actor spawnedActor = (Actor)sender; ActionList actionList = new ActionList(spawnedActor); actionLists.Add(actionList); actors.Add(spawnedActor); }
//double dotProduct; public Recoil(ActionList ownerList, Actor owner) { this.ownerList = ownerList; this.owner = owner; duration = 2/12F; originalColor = new Color(owner.color.ToVector3()); isBlocking = true; }
/// <summary> /// ���캯�� /// </summary> public ActionExport() { DataInputActionList = new ActionList(); VideoChannelActionList = new ActionList(); DataOutputActionList = new ActionList(); EquipmentWatchActionList = new ActionList(); ThisSystemActionList = new ActionList(); }
public Alert(ActionList ownerList, Actor owner, Actor target) { this.ownerList = ownerList; this.owner = owner; world = owner.world; this.target = target; elapsed = 0; duration = -1; }
public Idle(ActionList ownerList, Actor owner) { this.ownerList = ownerList; this.owner = owner; setAnimationInfo(); duration = -1; curFrame = 0; lastFrame = -1; }
public override object Clone() { ActionList list = new ActionList(); foreach(Action action in this) { list.Add((Action)action.Clone()); } return list; }
public void OnAdd() { var list = new ActionList<mockObject>(); list.OnAdd += new EventHandler<ActionArgs<mockObject>>((i, args) => { args.Item.Item = 2; }); var mock = new mockObject { Item = 1 }; list.Add(mock); Assert.AreEqual(2, mock.Item); }
public Neutral(ActionList ownerList, Actor owner) { this.ownerList = ownerList; this.owner = owner; elapsed = 0; duration = -1; world = owner.world; random = new Random(); }
public Walk(ActionList ownerList, Actor owner) { this.ownerList = ownerList; this.owner = owner; setAnimationInfo(); isBlocking = true; duration = ((float)animationInfo.frameCount) / animationInfo.fps; curFrame = 0; lastFrame = -1; }
private void Actor_Spawn(Object sender, SpawnEventArgs e) { Actor spawnedActor = (Actor)sender; ActionList actionList = new ActionList(spawnedActor); actionLists[spawnedActor] = actionList; actors.Add(spawnedActor); Idle idle = new Idle(actionLists[spawnedActor], spawnedActor); actionLists[spawnedActor].pushFront(idle); spawnedActor.id = actors.IndexOf(spawnedActor); }
public Walk(ActionList ownerList, Actor owner) { this.ownerList = ownerList; this.owner = owner; if(owner.animations.ContainsKey("walk")) animationInfo = owner.animations["walk"]; else animationInfo = new AnimationInfo("default_walk", 10, 12, 0, 0); duration = animationInfo.frames / animationInfo.fps; }
public Punch(ActionList ownerList, Actor owner) { this.ownerList = ownerList; this.owner = owner; isBlocking = true; attackBox = new Rectangle(0, 0, 9, 9); duration = (5f / 12f); curFrame = 0; hitActor = false; }
public void ReceiveActionList(SFSObject list) { SFSObject hierarchy = list.GetObj("h"); SetServerActionHierarchy(hierarchy); clientActionHierarchy = (ActionList)serverActionHierarchy.Clone(); SFSObject library = list.GetObj("l"); SetServerActionLibrary(library); hasReceivedActionList = true; }
public Aggravated(ActionList ownerList, Actor owner, Actor toFollow) { this.ownerList = ownerList; this.owner = owner; target = toFollow; nextPathPoint = new Point(0,0); elapsed = 0; duration = -1; isBlocking = true; }
public Pursue(ActionList ownerList, Actor owner, Actor toFollow) { this.ownerList = ownerList; this.owner = owner; target = toFollow; nextPathPoint = new Point(0,0); elapsed = 0; duration = -1; isBlocking = true; pathTileRectangle = new Rectangle(0, 0, owner.world.tileSize / 4, owner.world.tileSize / 4); }
public void OnAdd_Range() { var list = new ActionList<mockObject>(); list.OnAdd += new EventHandler<ActionArgs<mockObject>>((i, args) => { args.Item.Item = 2; }); var mock1 = new mockObject { Item = 1 }; var mock2 = new mockObject { Item = 1 }; list.AddRange(new List<mockObject>{mock1, mock2}); Assert.AreEqual(2, mock1.Item); Assert.AreEqual(2, mock2.Item); }
public Wander(ActionList ownerList, Actor owner) { this.ownerList = ownerList; this.owner = owner; elapsed = 0; duration = -1; searchPath = new List<Point>(); nextPathPoint = new Point(0, 0); isBlocking = true; random = new Random(); pathTileRectangle = new Rectangle(0, 0, owner.world.tileSize / 4, owner.world.tileSize / 4); }
public Follow(ActionList ownerList, Actor actor, Actor toFollow, World w, ActorManager aC) { actorManager = aC; this.ownerList = ownerList; this.owner = owner; target = toFollow; world = w; nextPathPoint = new Point(0,0); elapsed = 0; duration = -1; isBlocking = true; }
public Wander(ActionList ownerList, Actor owner) { this.ownerList = ownerList; this.owner = owner; elapsed = 0; duration = -1; searchPath = new List<Point>(); nextPathPoint = new Point(0, 0); isBlocking = true; world = owner.world; random = new Random(); }
public Aggravated(ActionList ownerList, Actor owner, Actor toFollow) { this.ownerList = ownerList; this.owner = owner; target = toFollow; nextPathPoint = new Point(0,0); elapsed = 0; duration = -1; attackCoolDown = 0; pursueCountDown = (2.5f); isBlocking = true; }
public void updateAction() { actionIndex++; if(actionIndex >= 4){ //stop the timer print ("I should now stop the timer"); actionTimer.timerHasStopped = true; }else{ curAction = alist[actionIndex]; actionPrompt.guiText.text = formatActionPromptText(); //the code that delay a code execution Invoke("changeEnvironment", 1); } }
public PreviewWindow(GameSaveManager manager, ActionList actions) { InitializeComponent(); this.manager = manager; this.actions = actions; this.StartPosition = FormStartPosition.CenterParent; this.CancelButton = this.buttonCancel; this.columnStatus.FillsFreeSpace = true; this.viewActions.AlwaysGroupByColumn = this.columnGame; this.viewActions.ClearObjects(); this.viewActions.SetObjects(this.actions); }
public Attack(ActionList ownerList, Actor owner) { this.ownerList = ownerList; this.owner = owner; isBlocking = true; frameIndex = new Point(0, 0); damageRect = new Rectangle(0, 0, 0, 0); attackBoxes = new List<Rectangle>(); setAnimationInfo(); duration = ((float)animationInfo.frameCount)/ animationInfo.fps; curFrame = 0; lastFrame = -1; owner.HitActor += Actor_Hit; }
private void Actor_Spawn(object sender, SpawnEventArgs e) { Actor spawnedActor = (Actor)sender; if (e.spawnType == 1) { protagonist = spawnedActor; } else if (e.spawnType == 2) { ActionList behaviorList = new ActionList(spawnedActor); Neutral neutral = new Neutral(behaviorList, spawnedActor); behaviorList.pushFront(neutral); Alert alert = new Alert(behaviorList, spawnedActor, protagonist); behaviorList.pushFront(alert); behaviorLists[spawnedActor] = behaviorList; } //actors.Add(spawnedActor); }
// Update is called once per frame void Update() { if (www.isDone&&loaded == false) { var jsonData = JSON.Parse(www.text); ActionList al; for(int i = 0; i<jsonData["actions"].Count; i++){ al = new ActionList(); string[] objects = new string[jsonData["actions"][i]["objects"].Count+1]; for(int j = 0; j<jsonData["actions"][i]["objects"].Count; j++){ objects[j] = jsonData["actions"][i]["objects"][j].Value; //al.targetObjects[j] = objects[j]; } al.targetObjects = objects; al.actionName = jsonData["actions"][i]["type"].Value; } loaded = true; //print("-----------111"+jsonData["actions"][0]["type"].Value+"-----------"); //string jsonString = jsonData; //print("-----------222"+jsonString+"-----------"); } }
// Start is called before the first frame update void Start() { StartCoroutine(GatherTick()); agent = GetComponent <NavMeshAgent>();//typeof(NavMashAgent) AL = FindObjectOfType <ActionList>(); }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); int Distance = Functions.MaxDistance(CurrentLocation, Target.CurrentLocation); int delay = Distance * 50 + 750; //50 MS per Step int damage = GetAttackPower(MinDC, MaxDC); attType = 0; if (HP < this.MaxHP / 2 && RandomUtils.Next(100) < 40 && CanSpawnWolf()) { attType = 1; } if (HP < this.MaxHP / 2) { damage = damage * 2; } if (attType == 0) { int rd = RandomUtils.Next(100); if (rd < 50) { attType = 0; } else if (rd < 70) { attType = 2; } else if (rd < 90) { attType = 3; } else { attType = 4; } } DelayedAction action = null; if (attType == 0) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, Target, damage, DefenceType.ACAgility); ActionList.Add(action); } if (attType == 1) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, Target, damage, DefenceType.ACAgility); ActionList.Add(action); SpawnWolf(); } if (attType == 2) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 2 }); action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, Target, damage * 2, DefenceType.ACAgility); ActionList.Add(action); } //范围减速 if (attType == 3) { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); List <MapObject> list = FindAllTargets(3, CurrentLocation, false); foreach (MapObject ob in list) { if (!ob.IsAttackTarget(this)) { continue; } action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, ob, damage * 3 / 2, DefenceType.MAC); ActionList.Add(action); //冰冻 if (RandomUtils.Next(Settings.PoisonResistWeight) >= Target.PoisonResist) { ob.ApplyPoison(new Poison { Owner = this, Duration = RandomUtils.Next(8, 15), PType = PoisonType.Slow, Value = damage / 3, TickSpeed = 1000 }, this); } } } //范围冰冻 if (attType == 4) { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); List <MapObject> list = FindAllTargets(2, CurrentLocation, false); foreach (MapObject ob in list) { if (!ob.IsAttackTarget(this)) { continue; } action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, ob, damage * 3 / 2, DefenceType.MAC); ActionList.Add(action); //冰冻 if (RandomUtils.Next(Settings.PoisonResistWeight) >= Target.PoisonResist) { //几率麻痹 if (RandomUtils.Next(100) < 50) { ob.ApplyPoison(new Poison { Owner = this, Duration = RandomUtils.Next(3, 5), PType = PoisonType.Frozen, Value = damage / 3, TickSpeed = 1000 }, this); } } } } ShockTime = 0; ActionTime = Envir.Time + 500; AttackTime = Envir.Time + (AttackSpeed); }
public override void Die() { ActionList.Add(new DelayedAction(DelayedType.Die, Envir.Time + 500)); base.Die(); }
public void AddAction(IActionList[] actions) { ActionList.AddRange(actions); }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; ShockTime = 0; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); bool ranged = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 2); if (!ranged) { if (Envir.Random.Next(5) > 0) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); PoisonLineAttack(2, damage, DefenceType.ACAgility); } else { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC] * 2); PoisonLineAttack(2, damage, DefenceType.ACAgility, true); } } else { if (Envir.Random.Next(10) > 0) { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID }); int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]); int delay = Functions.MaxDistance(CurrentLocation, Target.CurrentLocation) * 50 + 500; //50 MS per Step DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + delay, Target, damage, DefenceType.ACAgility, (byte)4); ActionList.Add(action); } else { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID, Type = 1 }); int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC] * 2); DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + 500, Target, damage, DefenceType.ACAgility, (byte)5); ActionList.Add(action); if (damage > 0) { SpawnSlaves(); } } } }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); if ((HP * 100 / MaxHP) < 20 && MassAttackTime < Envir.Time) { ShockTime = 0; ActionTime = Envir.Time + 500; AttackTime = Envir.Time + (AttackSpeed); Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); List <MapObject> targets = FindAllTargets(7, CurrentLocation, false); if (targets.Count == 0) { return; } int damage = GetAttackPower(MinDC, MaxDC); for (int i = 0; i < targets.Count; i++) { int delay = Functions.MaxDistance(CurrentLocation, targets[i].CurrentLocation) * 50 + 750; //50 MS per Step DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, targets[i], damage, DefenceType.ACAgility); ActionList.Add(action); } MassAttackTime = Envir.Time + 2000 + (RandomUtils.Next(5) * 1000); ActionTime = Envir.Time + 800; AttackTime = Envir.Time + (AttackSpeed); return; } if (Functions.InRange(CurrentLocation, Target.CurrentLocation, AttackRange - 1) && RandomUtils.Next(3) == 0) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); LineAttack(AttackRange - Functions.MaxDistance(CurrentLocation, Target.CurrentLocation) + 1, true); } else { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); LineAttack(AttackRange); } ShockTime = 0; ActionTime = Envir.Time + 500; AttackTime = Envir.Time + (AttackSpeed); }
protected void DrawSharedElements() { if (AdvGame.GetReferences() == null) { Debug.LogError("A References file is required - please use the Adventure Creator window to create one."); EditorGUILayout.LabelField("No References file found!"); } else { actionsManager = AdvGame.GetReferences().actionsManager; ActionList _target = (ActionList)target; if (actionsManager) { int numActions = _target.actions.Count; if (numActions < 1) { numActions = 1; string defaultAction = actionsManager.GetDefaultAction(); _target.actions.Add((Action)CreateInstance(defaultAction)); } EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Expand all")) { Undo.RegisterUndo(_target, "Expand actions"); foreach (Action action in _target.actions) { action.isDisplayed = true; } } if (GUILayout.Button("Collapse all")) { Undo.RegisterUndo(_target, "Collapse actions"); foreach (Action action in _target.actions) { action.isDisplayed = false; } } EditorGUILayout.EndHorizontal(); for (int i = 0; i < _target.actions.Count; i++) { EditorGUILayout.BeginVertical("Button"); typeNumber = GetTypeNumber(i); string actionLabel = " " + (i).ToString() + ": " + _target.actions[i].title + _target.actions[i].SetLabel(); _target.actions[i].isDisplayed = EditorGUILayout.Foldout(_target.actions[i].isDisplayed, actionLabel); if (_target.actions[i].isDisplayed) { typeNumber = EditorGUILayout.Popup("Action type:", typeNumber, actionsManager.GetActionTitles()); EditorGUILayout.Space(); // Rebuild constructor if Subclass and type string do not match if (_target.actions[i].GetType().ToString() != actionsManager.GetActionName(typeNumber)) { _target.actions[i] = RebuildAction(_target.actions[i], typeNumber); } ShowActionGUI(_target.actions[i], _target.gameObject, i, _target.actions.Count); EditorGUILayout.BeginHorizontal(); if (i > 0) { if (GUILayout.Button("Move up")) { Undo.RegisterUndo(_target, "Move action up"); _target.actions = AdvGame.SwapActions(_target.actions, i, i - 1); } } if (i < _target.actions.Count - 1) { if (GUILayout.Button("Insert new")) { Undo.RegisterUndo(_target, "Create action"); numActions += 1; _target.actions = ResizeList(_target.actions, numActions); // Swap all elements up one for (int k = numActions - 1; k > i + 1; k--) { _target.actions = AdvGame.SwapActions(_target.actions, k, k - 1); } } } if (_target.actions.Count > 1) { if (GUILayout.Button("Delete")) { Undo.RegisterUndo(_target, "Delete action"); _target.actions.RemoveAt(i); numActions -= 1; } } if (i < _target.actions.Count - 1) { if (GUILayout.Button("Move down")) { Undo.RegisterUndo(_target, "Move action down"); _target.actions = AdvGame.SwapActions(_target.actions, i, i + 1); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); } if (GUILayout.Button("Add new action")) { Undo.RegisterUndo(_target, "Create action"); numActions += 1; } _target.actions = ResizeList(_target.actions, numActions); } } }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } ShockTime = 0; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); bool ranged = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 2); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; /* Energy Shield Logic: When mob gets to certain health percentages (i.e. 80% / 60% / 40% / 20%) active Energy Shield. Whilst Energy Shield is active the following happen: - This monsters damage taken is reduced (50% reduction?) - Every 'x' amount of seconds all players in range are attacked with a thunderbolt */ var hpPercent = (HP * 100) / Stats[Stat.HP]; bool stage1Bubble = hpPercent >= 70 && hpPercent <= 80;//HP < Stats[Stat.HP] / 10 * 8 && this.HP > Stats[Stat.HP] / 10 * 7; bool stage2Bubble = hpPercent >= 40 && hpPercent <= 50;//HP < Stats[Stat.HP] / 10 * 5 && this.HP > Stats[Stat.HP] / 10 * 4; bool stage3Bubble = hpPercent <= 20; //this.HP < Stats[Stat.HP] / 10 * 2 && this.HP > 1; if (stage1Bubble == true || stage2Bubble == true || stage3Bubble == true) { if (Target != null) { var stats = new Stats { [Stat.MaxAC] = 100, [Stat.MinAC] = 100 }; AddBuff(BuffType.GeneralMeowMeowShield, this, ShieldUpDuration, stats, visible: true); if (Envir.Time > ThunderAttackTime) { MassThunderAttack(); } OperateTime = 0; } } if (!ranged) { if (Envir.Random.Next(9) != 0) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); if (damage == 0) return; DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage, DefenceType.ACAgility, false); ActionList.Add(action); } else { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]) * 3; if (damage == 0) return; DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage, DefenceType.AC, true); ActionList.Add(action); } } else { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID, Type = 0 }); int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]); if (damage == 0) return; DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + 500, Target, damage, DefenceType.MACAgility); ActionList.Add(action); } }
private void FormMain_Load(object sender, EventArgs e) { var position = new vec3(5, 6, 4) * 3; var center = new vec3(0, 0, 0); var up = new vec3(0, 1, 0); var camera = new Camera(position, center, up, CameraType.Perspective, this.winGLCanvas1.Width, this.winGLCanvas1.Height); this.scene = new Scene(camera); //(new FormTree(scene)).Show(); this.scene.RootNode = new GroupNode(); { var axisNode = AxisNode.Create(); axisNode.Scale = new vec3(1, 1, 1) * 30; this.scene.RootNode.Children.Add(axisNode); } var list = new ActionList(); var transformAction = new TransformAction(scene); list.Add(transformAction); var renderAction = new RenderAction(scene); list.Add(renderAction); this.actionList = list; this.pickingAction = new Picking(scene); //this.triangleTip = new LegacyTriangleNode(); //this.quadTip = new LegacyQuadNode(); this.tipNode = HighlightGeometryNode.Create(); var manipulater = new FirstPerspectiveManipulater(); manipulater.Bind(camera, this.winGLCanvas1); { ObjItem[] items = HanoiTower.GetDataSource(); for (int i = 0; i < items.Length; i++) { var item = items[i]; var filename = "item" + (i) + ".obj"; item.model.DumpObjFile(filename, "item" + (i)); var parser = new ObjVNFParser(false); ObjVNFResult result = parser.Parse(filename); if (result.Error != null) { //Console.WriteLine("Error: {0}", result.Error); } else { ObjVNFMesh mesh = result.Mesh; var node = ObjVNFNode.Create(mesh); node.Children.Add(new LegacyBoundingBoxNode(node.ModelSize)); //float max = node.ModelSize.max(); //node.Scale *= 7.0f / max; node.WorldPosition = item.position; node.Diffuse = item.color; var rootElement = this.scene.RootNode; this.scene.RootNode.Children.Add(node); //if (rootElement != null) { rootElement.Dispose(); } } } } }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } ShockTime = 0; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); bool ranged = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 1); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; if (!ranged) { switch (Envir.Random.Next(6)) { case 0: case 3: case 4: { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); if (damage == 0) { return; } DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage, DefenceType.ACAgility, false); ActionList.Add(action); } break; case 1: case 5: { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]) * 2; if (damage == 0) { return; } DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 600, Target, damage, DefenceType.ACAgility, true); ActionList.Add(action); } break; case 2: { AttackTime = Envir.Time + AttackSpeed + 500; Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID }); int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]); if (damage == 0) { return; } int delay = Functions.MaxDistance(CurrentLocation, Target.CurrentLocation) * 50 + 500; //50 MS per Step DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + delay, Target, damage, DefenceType.MACAgility, true); ActionList.Add(action); } break; } } else { AttackTime = Envir.Time + AttackSpeed + 500; Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID }); int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]); if (damage == 0) { return; } int delay = Functions.MaxDistance(CurrentLocation, Target.CurrentLocation) * 50 + 500; //50 MS per Step DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + delay, Target, damage, DefenceType.MACAgility, true); ActionList.Add(action); } }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } ShockTime = 0; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); bool range = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 1); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; if (!range) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); int damage = GetAttackPower(MinDC, MaxDC); if (damage == 0) { return; } Target.Attacked(this, damage, DefenceType.ACAgility); } else { { if (Envir.Random.Next(3) > 0) { //Rhino Ranged Attack Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID, Type = 0 }); AttackTime = Envir.Time + AttackSpeed + 500; int damage = GetAttackPower(MinMC, MaxMC); if (damage == 0) { return; } DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage, DefenceType.MAC); ActionList.Add(action); } else { //Blue Circle Attack Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID, Type = 1 }); AttackTime = Envir.Time + AttackSpeed + 500; int damage = GetAttackPower(MinMC, MaxMC); if (damage == 0) { return; } if (Envir.Random.Next(Settings.PoisonResistWeight) >= Target.PoisonResist) { if (Envir.Random.Next(2) == 0) { Target.ApplyPoison(new Poison { Owner = this, Duration = 5, PType = PoisonType.Slow, Value = GetAttackPower(MinSC, MaxSC), TickSpeed = 1000 }, this); } if (Envir.Random.Next(4) == 0) { Target.ApplyPoison(new Poison { Owner = this, Duration = 5, PType = PoisonType.Frozen, Value = GetAttackPower(MinSC, MaxSC), TickSpeed = 1000 }, this); } } DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage, DefenceType.MAC); ActionList.Add(action); } } } if (Target.Dead) { FindTarget(); } }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } ShockTime = 0; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); bool ranged = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 1); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); if (!ranged) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); if (damage == 0) { return; } Target.Attacked(this, damage, DefenceType.ACAgility); } else { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID }); AttackTime = Envir.Time + AttackSpeed + 500; if (damage == 0) { return; } int delay = Functions.MaxDistance(CurrentLocation, Target.CurrentLocation) * 50 + 500; //50 MS per Step DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, Target, damage, DefenceType.MAC); ActionList.Add(action); if (Envir.Random.Next(Settings.PoisonResistWeight) >= Target.Stats[Stat.PoisonResist]) { if (Envir.Random.Next(8) == 0) { if (Info.Effect == 0) { Target.ApplyPoison(new Poison { Owner = this, Duration = 5, PType = PoisonType.Bleeding, TickSpeed = 1000, }, this); } else if (Info.Effect == 1) { Target.ApplyPoison(new Poison { Owner = this, Duration = 5, PType = PoisonType.Slow, TickSpeed = 1000, }, this); } } } } if (Target.Dead) { FindTarget(); } }
private void FormMain_Load(object sender, EventArgs e) { foreach (var item in Enum.GetNames(typeof(EnvironmentMappingNode.Ratio))) { this.cmbRatios.Items.Add(item); } var position = new vec3(8, 0, 4) * 3; var center = new vec3(0, 0, 0); var up = new vec3(0, 1, 0); var camera = new Camera(position, center, up, CameraType.Perspecitive, this.winGLCanvas1.Width, this.winGLCanvas1.Height); string folder = System.Windows.Forms.Application.StartupPath; var totalBmp = new Bitmap(System.IO.Path.Combine(folder, @"cubemaps_skybox.png")); Bitmap[] bitmaps = GetBitmaps(totalBmp); this.skybox = SkyboxNode.Create(bitmaps); this.skybox.Scale *= 60; string objFilename = System.IO.Path.Combine(folder + @"\..\..\..\..\Infrastructure\CSharpGL.Models", "nanosuit.obj_"); var parser = new ObjVNFParser(false); ObjVNFResult result = parser.Parse(objFilename); if (result.Error != null) { MessageBox.Show(result.Error.ToString()); } else { var model = new ObjVNF(result.Mesh); var node = EnvironmentMappingNode.Create( this.skybox.SkyboxTexture, model, ObjVNF.strPosition, ObjVNF.strNormal); node.ModelSize = model.GetSize(); float max = node.ModelSize.max(); node.Scale *= 20.0f / max; node.Children.Add(new LegacyBoundingBoxNode(node.ModelSize)); this.environmentMappingNode = node; var group = new GroupNode(this.environmentMappingNode, this.skybox); this.scene = new Scene(camera) { RootNode = group, }; var list = new ActionList(); var transformAction = new TransformAction(scene.RootNode); list.Add(transformAction); var renderAction = new RenderAction(scene); list.Add(renderAction); this.actionList = list; var manipulater = new FirstPerspectiveManipulater(); manipulater.Bind(camera, this.winGLCanvas1); this.pickingAction = new Picking(scene); this.triangleTip = new LegacyTriangleNode(); this.quadTip = new LegacyQuadNode(); } }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } AttackTime = Envir.Time + AttackSpeed; ShockTime = 0; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); //Charge-Up AOE Rock Fall if (_StartAdvanced && Envir.Random.Next(20) == 0) { byte rockFallLoops = (byte)Envir.Random.Next(5, 10); int rockFallDuration = rockFallLoops * 500; _Immune = true; ActionTime = Envir.Time + (rockFallDuration) + 500; AttackTime = Envir.Time + (rockFallDuration) + 500 + AttackSpeed; Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 3, Level = rockFallLoops }); var front = Functions.PointMove(CurrentLocation, Direction, 2); MassSpawnRockFall(front, rockFallDuration); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]) * rockFallLoops; DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + (rockFallDuration) + 500, Target, damage, DefenceType.AC, 5); ActionList.Add(action); return; } //Charge-Up Spin Hit if (_StartAdvanced && Envir.Random.Next(15) == 0) { byte spinLoops = (byte)Envir.Random.Next(5, 10); int spinDuration = spinLoops * 700; _Immune = true; ActionTime = Envir.Time + spinDuration + 1500; AttackTime = Envir.Time + spinDuration + 1500 + AttackSpeed; Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 2, Level = spinLoops }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]) * spinLoops; DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + spinDuration + 500, Target, damage, DefenceType.AC, true); ActionList.Add(action); action = new DelayedAction(DelayedType.Damage, Envir.Time + spinDuration + 1000, Target, damage, DefenceType.AC, true); ActionList.Add(action); return; } //Hammer Smash if (_StartAdvanced && Envir.Random.Next(10) == 0) { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); if (damage == 0) { return; } DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + 300, Target, damage, DefenceType.AC, 3); ActionList.Add(action); return; } //Teleport if (_StartAdvanced && Envir.Random.Next(10) == 0) { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + 300); ActionList.Add(action); return; } //Normal Attacks if (Envir.Random.Next(2) == 0) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); if (damage == 0) { return; } DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage, DefenceType.ACAgility, false); ActionList.Add(action); } else { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); if (damage == 0) { return; } DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage, DefenceType.ACAgility, false); ActionList.Add(action); } }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } ShockTime = 0; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); bool ranged = CurrentLocation == Target.CurrentLocation || !InAttackRange(); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; int damage; if (!ranged && Envir.Random.Next(3) > 0) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); damage = GetAttackPower(MinDC, MaxDC); if (damage == 0) { return; } List <MapObject> targets = FindAllTargets(1, CurrentLocation); if (targets.Count == 0) { return; } int levelgap; for (int i = 0; i < targets.Count; i++) { if (targets[i].IsAttackTarget(this)) { levelgap = 60 - targets[i].Level; if (Envir.Random.Next(20) < 4 + levelgap) { if (Envir.Random.Next(Settings.MagicResistWeight) < targets[i].MagicResist) { continue; } if (targets[i].Pushed(this, Functions.DirectionFromPoint(CurrentLocation, targets[i].CurrentLocation), 3 + Envir.Random.Next(3)) > 0 && Envir.Random.Next(8) == 0) { targets[i].ApplyPoison(new Poison { PType = PoisonType.Paralysis, Duration = 5, TickSpeed = 1000 }, this, true); } } } } LineAttack(2); } else { AttackTime = Envir.Time + AttackSpeed + 500; Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); damage = GetAttackPower(MinMC, MaxMC); if (damage == 0) { return; } DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage, DefenceType.MAC); ActionList.Add(action); } if (Target.Dead) { FindTarget(); } }
protected DialogResult ShowPreviewDialog(ActionList actions) { PreviewWindow preview = new PreviewWindow(this, actions); preview.ShowDialog(); return preview.DialogResult; }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } ShockTime = 0; ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); if (Envir.Random.Next(7) > 0) { if (Envir.Random.Next(2) > 0) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); if (damage == 0) { return; } DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility, false); ActionList.Add(action); } else { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 2 }); int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]); if (damage == 0) { return; } DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.MAC, true); ActionList.Add(action); } } else { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); if (damage == 0) { return; } HalfmoonAttack(damage, 300); } }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); int damage = GetAttackPower(MinDC, MaxDC); int distance = Functions.MaxDistance(CurrentLocation, Target.CurrentLocation); int delay = distance * 50 + 500; //50 MS per Step DelayedAction action = null; int rd = RandomUtils.Next(100); if (rd <= 60) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, Target, damage / 3 * 2, DefenceType.None); ActionList.Add(action); action = new DelayedAction(DelayedType.Damage, Envir.Time + delay + 200, Target, damage, DefenceType.None); ActionList.Add(action); } else if (rd <= 80) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); List <MapObject> listtargets = CurrentMap.getMapObjects(CurrentLocation.X, CurrentLocation.Y, 3); for (int o = 0; o < listtargets.Count; o++) { MapObject ob = listtargets[o]; if (ob.Race != ObjectType.Player && ob.Race != ObjectType.Monster) { continue; } if (!ob.IsAttackTarget(this)) { continue; } action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, ob, damage, DefenceType.MAC); ActionList.Add(action); } } else if (rd <= 90) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 2 }); List <MapObject> listtargets = CurrentMap.getMapObjects(CurrentLocation.X, CurrentLocation.Y, 3); for (int o = 0; o < listtargets.Count; o++) { MapObject ob = listtargets[o]; if (ob.Race != ObjectType.Player && ob.Race != ObjectType.Monster) { continue; } if (!ob.IsAttackTarget(this)) { continue; } action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, ob, damage, DefenceType.MAC); ActionList.Add(action); action = new DelayedAction(DelayedType.Damage, Envir.Time + delay + 300, ob, damage, DefenceType.MAC); ActionList.Add(action); } } else { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, TargetID = Target.ObjectID, Location = CurrentLocation, Type = 0 }); action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, Target, damage, DefenceType.MAC); ActionList.Add(action); if (RandomUtils.Next(Settings.PoisonResistWeight) >= Target.PoisonResist) { Target.ApplyPoison(new Poison { Owner = this, Duration = RandomUtils.Next(3, 6), PType = PoisonType.Frozen, Value = damage / 10, TickSpeed = 1000 }, this); } } ShockTime = 0; ActionTime = Envir.Time + 500; AttackTime = Envir.Time + (AttackSpeed); }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); if (_attackCount >= 5) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 2 }); int damage = GetAttackPower(MinMC, MaxMC); List <MapObject> targets = FindAllTargets(3, CurrentLocation); for (int i = 0; i < targets.Count; i++) { //targets[i].Attacked(this, damage, DefenceType.MAC); DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 350, targets[i], damage, DefenceType.MAC); ActionList.Add(action); if (Envir.Random.Next(Settings.PoisonResistWeight) >= targets[i].PoisonResist) { if (Envir.Random.Next(5) == 0) { targets[i].ApplyPoison(new Poison { PType = PoisonType.Frozen, Duration = 5, TickSpeed = 1000 }, this); } } } _attackCount = 0; return; } switch (Envir.Random.Next(3)) { case 0: case 1: _attackCount++; base.Attack(); break; case 2: { int damage = GetAttackPower(MinDC, MaxDC); Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); MirDirection dir = Functions.PreviousDir(Direction); Point tar; Cell cell; for (int i = 0; i < 8; i++) { tar = Functions.PointMove(CurrentLocation, dir, 1); dir = Functions.NextDir(dir); if (tar == Front) { continue; } if (!CurrentMap.ValidPoint(tar)) { continue; } cell = CurrentMap.GetCell(tar); if (cell.Objects == null) { continue; } for (int o = 0; o < cell.Objects.Count; o++) { MapObject ob = cell.Objects[o]; if (ob.Race != ObjectType.Player && ob.Race != ObjectType.Monster) { continue; } if (!ob.IsAttackTarget(this)) { continue; } //ob.Attacked(this, damage, DefenceType.Agility); DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 350, ob, damage, DefenceType.Agility); ActionList.Add(action); break; } } break; } } ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; ShockTime = 0; }
private void SetServerActionHierarchy(SFSObject hierarchy) { serverActionHierarchy = new ActionList(); for (int a = 0; a < hierarchy.Size(); a++) { SFSObject actionObject = hierarchy.GetObj(Convert.ToString(a)); Action action = new Action(); action.name = actionObject.GetString("n"); int numParam = actionObject.Size(); for (int i = 0; i < numParam - 1; i++) { SFSObject param = actionObject.GetObj(Convert.ToString(i)); string paramName = param.GetString("n"); string paramType = param.GetString("t"); switch (paramType) { case "b" ://boolean bool boolValue = param.GetBool("v"); action.AddBoolParam(paramName, boolValue); break; case "maq"://maximum quantity (integer > 0 or "MAX") // break; case "miq"://minimum quantity (integer > 0 or "MIN") // break; case "n"://integer with min and max values // break; case "mi"://minored integer : integer with min value or "INF" string value = param.GetString("v"); int minValue = (int) param.GetNumber("m"); action.AddMinoredIntegerParam(paramName, value, minValue); break; case "ii"://inventory item // break; case "it"://item type // break; case "am"://actionMark (an absolute position or the position of a physical entity marked by the player or his faction) bool playerIsMarkOwner = param.GetBool("o"); int actionMarkID = (int)param.GetNumber("n"); action.AddActionMark(paramName, playerIsMarkOwner, actionMarkID); break; case "c"://character (player or npc) // break; case "s"://string message // break; } } serverActionHierarchy.Add(action); } }
public void RegisterCommand(char symbol, Action <IVirtualMachine> execute) { ActionList.Add(symbol, execute); }
public void AddAction(IActionList action) { ActionList.Add(action); }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } DelayedAction action; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); bool ranged = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 1); int damage = 0; if (ranged) { if (tornado) { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0, TargetID = Target.ObjectID }); damage = GetAttackPower(MinDC, MaxDC); List <MapObject> targets = FindAllTargets(1, Target.CurrentLocation); for (int i = 0; i < targets.Count; i++) { action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + 1000, targets[i], damage, DefenceType.ACAgility); ActionList.Add(action); } ActionTime = Envir.Time + 800; AttackTime = Envir.Time + AttackSpeed; tornado = false; return; } } if (!ranged) { if (stomp) { //Foot stomp Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 2 }); MirDirection dir = Functions.PreviousDir(Direction); Point tar; Cell cell; damage = GetAttackPower(MinDC, MaxDC); for (int i = 0; i < 8; i++) { tar = Functions.PointMove(CurrentLocation, dir, 1); dir = Functions.NextDir(dir); if (!CurrentMap.ValidPoint(tar)) { continue; } cell = CurrentMap.GetCell(tar); if (cell.Objects == null) { continue; } for (int o = 0; o < cell.Objects.Count; o++) { MapObject ob = cell.Objects[o]; if (ob.Race != ObjectType.Player && ob.Race != ObjectType.Monster) { continue; } if (!ob.IsAttackTarget(this)) { continue; } action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility, AttackType.Stomp); ActionList.Add(action); break; } } ActionTime = Envir.Time + 800; AttackTime = Envir.Time + AttackSpeed; stomp = false; return; } switch (Envir.Random.Next(2)) { case 0: //Slash Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); damage = GetAttackPower(MinDC, MaxDC); action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility, AttackType.SingleSlash); ActionList.Add(action); damage = GetAttackPower(MinDC, MaxDC); action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage, DefenceType.ACAgility, AttackType.SingleSlash); ActionList.Add(action); break; case 1: //Two hand slash Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); damage = GetAttackPower(MinDC, MaxDC); action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility, AttackType.SingleSlash); ActionList.Add(action); break; } if (Envir.Random.Next(5) == 0) { stomp = true; } if (Envir.Random.Next(2) == 0) { tornado = true; } } ActionTime = Envir.Time + 500; AttackTime = Envir.Time + AttackSpeed; ShockTime = 0; }
protected override void Attack() { int damage = GetAttackPower(MinDC, MaxDC); if (damage == 0) { return; } int distance = Functions.MaxDistance(CurrentLocation, Target.CurrentLocation); int delay = 800; //50 MS per Step DelayedAction action = null; switch (attckType) { case 0: action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, Target, damage, DefenceType.ACAgility); ActionList.Add(action); Target.Pushed(this, Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation), 2); break; case 1: //近身地刺伤害增加1.5倍 if (distance < 3) { action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage * 3 / 2, DefenceType.ACAgility); ActionList.Add(action); } else { Broadcast(new S.ObjectEffect { ObjectID = Target.ObjectID, Effect = SpellEffect.TreeQueen }); action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage, DefenceType.MACAgility); ActionList.Add(action); } break; case 2: //随机挑选1个进行攻击,尽量挑选玩家 Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, TargetID = Target.ObjectID, Location = CurrentLocation, Type = 0 }); List <MapObject> targets2 = FindAllTargets(2, Target.CurrentLocation); for (int i = 0; i < targets2.Count; i++) { action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, targets2[i], damage, DefenceType.MACAgility); ActionList.Add(action); if (RandomUtils.Next(Settings.PoisonResistWeight) >= targets2[i].PoisonResist) { if (RandomUtils.Next(10) < 7) { targets2[i].ApplyPoison(new Poison { PType = PoisonType.Paralysis, Duration = 6, TickSpeed = 1000 }, this); } } } break; case 3: //随机挑选1个进行攻击,2段伤害 Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, TargetID = Target.ObjectID, Location = CurrentLocation, Type = 1 }); List <MapObject> targets3 = FindAllTargets(3, Target.CurrentLocation); for (int i = 0; i < targets3.Count; i++) { action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, targets3[i], damage * 2 / 3, DefenceType.MACAgility); ActionList.Add(action); action = new DelayedAction(DelayedType.Damage, Envir.Time + 800, targets3[i], damage * 3 / 2, DefenceType.MACAgility); ActionList.Add(action); } break; } }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } ShockTime = 0; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID }); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; int damage = GetAttackPower(MinDC, MaxDC); // into this atk if (damage == 0) { return; } int boost = 0; switch (PetLevel) { case 1: boost = 5; break; case 2: boost = 10; break; case 3: boost = 15; break; case 4: boost = 20; break; case 5: boost = 25; break; case 6: boost = 30; break; case 7: boost = 35; break; } if (boost > 0) { int tmp = damage * boost / 100; damage += tmp; } long delay = Functions.MaxDistance(CurrentLocation, Target.CurrentLocation) * 50 + 500; //50 MS per Step List <MapObject> targets = FindAllTargets(1, Target.CurrentLocation, false); if (targets.Count > 0) { for (int i = 0; i < targets.Count; i++) { if (targets[i].IsAttackTarget(this)) { DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, targets[i], damage, DefenceType.MAC); ActionList.Add(action); } } } else if (CurrentMap.ValidPoint(Target.CurrentLocation)) { Cell cell = CurrentMap.GetCell(Target.CurrentLocation); if (cell != null && cell.Objects != null && cell.Objects.Count > 0) { for (int i = 0; i < cell.Objects.Count; i++) { if (cell.Objects[i].Race != ObjectType.Player && cell.Objects[i].Race != ObjectType.Monster) { continue; } if (cell.Objects[i].IsAttackTarget(this)) { DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, cell.Objects[i], damage, DefenceType.MAC); ActionList.Add(action); } } } } else { DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, Target, damage, DefenceType.MAC); ActionList.Add(action); } if (Target.Dead) { FindTarget(); } }
public Carteira() { Lancamentos = new ActionList <Movimento>(c => c.Carteira = this, c => c.Carteira = null); }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } ShockTime = 0; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); bool ranged = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 1); ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; if (!ranged) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); if (damage == 0) { return; } DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, Target, damage, DefenceType.AC); ActionList.Add(action); } else { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); var location = Functions.PointMove(CurrentLocation, Direction, 3); for (int y = location.Y - 2; y <= location.Y + 2; y++) { if (y < 0) { continue; } if (y >= CurrentMap.Height) { break; } for (int x = location.X - 2; x <= location.X + 2; x++) { if (x < 0) { continue; } if (x >= CurrentMap.Width) { break; } var cell = CurrentMap.GetCell(x, y); if (!cell.Valid) { continue; } int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MinDC]); var start = 500; SpellObject ob = new SpellObject { Spell = Spell.StoneGolemQuake, Value = damage, ExpireTime = Envir.Time + 800 + start, TickSpeed = 1000, Direction = Direction, CurrentLocation = new Point(x, y), CastLocation = CurrentLocation, Show = location.X == x && location.Y == y, CurrentMap = CurrentMap }; Broadcast(new S.MapEffect { Effect = SpellEffect.Tester, Location = new Point(x, y), Value = (byte)Direction }); DelayedAction action = new DelayedAction(DelayedType.Spawn, Envir.Time + start, ob); CurrentMap.ActionList.Add(action); } } } }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); int damage = GetAttackPower(MinDC, MaxDC); int distance = Functions.MaxDistance(CurrentLocation, Target.CurrentLocation); int delay = distance * 50 + 500; //50 MS per Step DelayedAction action = null; int rd = RandomUtils.Next(100); byte attackType = 1; if (_stage == 1) { damage = damage * 3 / 2; if (rd < 65 && distance < 2) { attackType = 1; } else { attackType = 5; } } else { if (rd < 65 && distance < 2) { attackType = 1; } else { if (rd < 70) { attackType = 3; } else if (rd < 85) { attackType = 2; } else { attackType = 4; } } } /// 1.普通攻击 /// 2.加buf /// 3.普通符 /// 4.减速符 /// 5.高攻符 if (attackType == 1) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, Target, damage, DefenceType.ACAgility); ActionList.Add(action); } if (attackType == 2) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); _stage = 1; AttackedCount = RandomUtils.Next(3); fireTime = Envir.Time + RandomUtils.Next(6, 12) * 1000; Broadcast(GetInfo()); } if (attackType == 3) { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, TargetID = Target.ObjectID, Location = CurrentLocation, Type = 0 }); action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, Target, damage, DefenceType.MACAgility); ActionList.Add(action); } if (attackType == 4) { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, TargetID = Target.ObjectID, Location = CurrentLocation, Type = 1 }); action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, Target, damage, DefenceType.MAC); ActionList.Add(action); if (RandomUtils.Next(Settings.PoisonResistWeight) >= Target.PoisonResist && RandomUtils.Next(100) < 85) { Target.ApplyPoison(new Poison { Owner = this, Duration = RandomUtils.Next(6, 12), PType = PoisonType.Slow, Value = damage / 8, TickSpeed = 2000 }, this); } } if (attackType == 5) { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, TargetID = Target.ObjectID, Location = CurrentLocation, Type = 2 }); action = new DelayedAction(DelayedType.Damage, Envir.Time + delay, Target, damage, DefenceType.MAC); ActionList.Add(action); action = new DelayedAction(DelayedType.Damage, Envir.Time + delay + 300, Target, damage, DefenceType.MAC); ActionList.Add(action); } ShockTime = 0; ActionTime = Envir.Time + 500; AttackTime = Envir.Time + (AttackSpeed); }
private void button4_Click(object sender, EventArgs e) { if (m_Type == typeof(FilterList)) { FilterList fl = (FilterList)m_Object; if (fl != null) { fl.name = GenerateName(); fl.filters.Clear(); foreach (Filter curf in listBox1.Items) { fl.filters.Add(curf); } fl.Update(); } else { fl = new FilterList(GenerateName()); foreach (Filter curf in listBox1.Items) { fl.filters.Add(curf); } m_Object = fl; } } else if (m_Type == typeof(CodeBlock)) { CodeBlock fl = (CodeBlock)m_Object; if (fl != null) { fl.name = GenerateName(); fl.FilterLists.Clear(); foreach (FilterList curf in listBox1.Items) { fl.FilterLists.Add(curf); } fl.Update(); } else { fl = new CodeBlock(GenerateName()); foreach (FilterList curf in listBox1.Items) { fl.FilterLists.Add(curf); } m_Object = fl; } } else if (m_Type == typeof(Sequence)) { Sequence fl = (Sequence)m_Object; if (fl != null) { fl.name = GenerateName(); fl.CodeBlocks.Clear(); foreach (CodeBlock curf in listBox1.Items) { fl.CodeBlocks.Add(curf); } fl.Update(); } else { fl = new Sequence(GenerateName()); foreach (CodeBlock curf in listBox1.Items) { fl.CodeBlocks.Add(curf); } m_Object = fl; } } else if (m_Type == typeof(ActionList)) { ActionList fl = (ActionList)m_Object; if (fl != null) { fl.name = GenerateName(); fl.Actions.Clear(); foreach (UOAIBasic.Action curf in listBox1.Items) { fl.Actions.Add(curf); } fl.Update(); } else { fl = new ActionList(GenerateName()); foreach (UOAIBasic.Action curf in listBox1.Items) { fl.Actions.Add(curf); } m_Object = fl; } } DialogResult = DialogResult.OK; Close(); }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } ShockTime = 0; ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); bool ranged = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 1); if (!ranged) { if (Envir.Random.Next(3) > 0) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]); if (damage == 0) { return; } DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility); ActionList.Add(action); } else { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); FullmoonAttack(); } } else { if (Envir.Random.Next(3) > 0) { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID, Type = 0 }); int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]); if (damage == 0) { return; } DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.MACAgility); ActionList.Add(action); } else { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID, Type = 1 }); int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]) * 2; if (damage == 0) { return; } DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.MACAgility); ActionList.Add(action); } } }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); if (Envir.Random.Next(3) > 0) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); } else { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 }); MirDirection dir = Functions.PreviousDir(Direction); Point target; Cell cell; for (int i = 0; i < 4; i++) { target = Functions.PointMove(CurrentLocation, Direction, 1); dir = Functions.NextDir(Direction); if (target == Front) { continue; } if (!CurrentMap.ValidPoint(target)) { continue; } cell = CurrentMap.GetCell(target); if (cell.Objects == null) { continue; } for (int o = 0; o < cell.Objects.Count; o++) { MapObject ob = cell.Objects[o]; if (ob.Race != ObjectType.Player && ob.Race != ObjectType.Monster) { continue; } if (!ob.IsAttackTarget(this)) { continue; } //ob.Attacked(this, MinDC, DefenceType.ACAgility); DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 350, Target, MinDC, DefenceType.ACAgility); ActionList.Add(action); if (Envir.Random.Next(Settings.PoisonResistWeight) >= ob.PoisonResist) { if (Envir.Random.Next(5) == 0) { ob.ApplyPoison(new Poison { PType = PoisonType.Stun, Duration = Envir.Random.Next(1, 4), TickSpeed = 1000 }, this); } } break; } } } ShockTime = 0; ActionTime = Envir.Time + 300; AttackTime = Envir.Time + AttackSpeed; int damage = GetAttackPower(MinDC, MaxDC); if (damage == 0) { return; } Target.Attacked(this, damage, DefenceType.ACAgility); }
protected override void Attack() { if (!Target.IsAttackTarget(this)) { Target = null; return; } ShockTime = 0; Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation); if (Functions.InRange(CurrentLocation, Target.CurrentLocation, 3)) { if (RandomUtils.Next(2) == 0 || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 2)) { Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0 }); int damage = GetAttackPower(MinMC, MaxMC); if (damage == 0) { return; } List <MapObject> targets = FindAllTargets(3, CurrentLocation, false); if (targets.Count == 0) { return; } for (int i = 0; i < targets.Count; i++) { DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 500, targets[i], damage, DefenceType.MACAgility); ActionList.Add(action); } } else { WalkAway(); } } else { Broadcast(new S.ObjectRangeAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID, Type = 1 }); List <MapObject> targets = FindAllTargets(3, Target.CurrentLocation, false); if (targets.Count == 0) { return; } for (int i = 0; i < targets.Count; i++) { int damage = GetAttackPower(MinDC, MaxDC); if (damage == 0) { continue; } int delay = Functions.MaxDistance(CurrentLocation, targets[i].CurrentLocation) * 50 + 500; //50 MS per Step DelayedAction action = new DelayedAction(DelayedType.RangeDamage, Envir.Time + delay, targets[i], damage, DefenceType.ACAgility); ActionList.Add(action); } } ActionTime = Envir.Time + 500; AttackTime = Envir.Time + AttackSpeed; if (Target.Dead) { FindTarget(); } }