public Steps Step { get; private set; }
Steps countdownStep;
int secondsRemaining;
public HuntingSpiderKind() {
title.Text = "副本【猎杀蜘蛛魔王】";
TriggerOrgan = new bool[stepExplanation.Count];
}
/// <summary>
/// 开始
/// </summary>
public override void Run(List<RoleBase> players, Space space) {
this.space = space;
this.players = players;
players[0].PositionChanged += new DependencyPropertyChangedEventHandler(player0_PositionChanged);
checkTimer.Start();
//离开的传送门(测试用)
space.AddAnimation(new AnimationBase() {
ID = 0,
Code = 81,
Position = new Point(-1320, 1970),
Z = 1970,
Tip = "离开副本",
Loop = true,
});
space.RunWeather(WeatherTypes.Cloud, 50);
}
///<summary>进度检查(网络版中为所有玩家都要检测,目前单机只检测players[0]即主角)</summary>
protected override void StepCheck(object sender, EventArgs e) {
SetDescription(string.Format("Step {0}: {1}", (int)Step, stepExplanation[Step]));
switch (Step) {
case Steps.设置右键魔法8级连锁闪电或6级石封箭:
if ((players[0].CurrentMagic.Level == 8 && players[0].CurrentMagic.Code == 9) || (players[0].CurrentMagic.Level == 6 && players[0].CurrentMagic.Code == 12)) {
space.AddAnimation(new AnimationBase() {
ID = 0,
Code = 82,
Position = new Point(-583, 1695),
Z = 1695,
Tip = "传送点",
Loop = true,
});
space.Terrain.AddTeleport(new Teleport() {
Code = 0,
ToSpace = space.Code,
Instance = InstanceTypes.None,
ToCoordinate = new Point(46, 72),
ToDirection = Directions.SouthEast
}, "45_68_0,46_68_0,");
StartCountdown(Steps.十二秒内到达传送点, 12);
}
break;
case Steps.消灭所有翼族:
if (space.AllRoles().Count == players.Count) { //这样的检测方案只是暂定的,很可能存在BUG
Step = Steps.进入传送点到达山的彼岸;
space.AddAnimation(new AnimationBase() {
ID = 0,
Code = 82,
Position = new Point(-238, 2018),
Z = 2018,
Tip = "传送点",
Loop = true,
});
space.Terrain.AddTeleport(new Teleport() {
Code = 1,
ToSpace = space.Code,
Instance = InstanceTypes.None,
ToCoordinate = new Point(73, 25),
ToDirection = Directions.SouthWest
}, "63_71_0,62_70_0,62_72_0,");
}
break;
case Steps.设置右键魔法为7级陨石坠落:
if (players[0].CurrentMagic.Level == 7 && players[0].CurrentMagic.Code == 7) {
StartCountdown(Steps.等待3秒刺客来袭, 3);
}
break;
case Steps.消灭所有刺客:
if (space.AllRoles().Count == players.Count) {
Step = Steps.骑上马并移动到59_60附近开启封印;
}
break;
case Steps.骑上马并移动到59_60附近开启封印:
if (TriggerOrgan[(int)Step]) {
StartCountdown(Steps.在23秒内为武器附上烟火粒子, 23);
}
break;
case Steps.在23秒内为武器附上烟火粒子:
if (players[0].DisplayWeaponParticle) {
StartCountdown(Steps.在180秒内消灭蜘蛛魔王, 180);
Monster boss = new Monster(space.Terrain) {
ID = 3120000,
//AttachID = 4100000,
Code = 2,
FullName = "蜘蛛魔王",
LearnedMagic = new Dictionary<int, int>() { { 0, 6 }, { 1, 6 }, { 2, 6 }, { 3, 6 }, { 4, 6 }, { 5, 6 }, { 6, 6 }, { 7, 6 }, { 8, 6 }, { 9, 6 }, { 10, 6 }, { 11, 6 }, { 12, 6 }, { 13, 6 }, { 14, 6 }, { 15, 6 }, { 16, 6 }, { 17, 6 }, { 18, 6 } },
Profession = Professions.Monster,
ArmorCode = 16,
Direction = Directions.SouthEast,
State = States.Walking,
Camp = Camps.Eval,
TacticAI = TacticAIs.GoalLeader,
ActionAI = ActionAIs.Persistent,
LifeMax = 640000,
Life = 640000,
ATK = 24059,
DEF = 1500,
MAG = 500,
DEX = ObjectBase.RandomSeed.Next(0, 30),
Coordinate = new Point(49, 59)
};
space.AddRole(boss, new RoleAddedEventArgs() {
RegisterDisposedEvent = true,
RegisterIntervalTriggerEvent = true,
RegisterActionTriggerEvent = true,
RegisterDoAttackEvent = true,
RegisterDoCastingEvent = true,
RegisterPositionChangedEvent = true,
RegisterLifeChangedEvent = true,
});
space.MusicUri = "Boss";
}
break;
case Steps.在180秒内消灭蜘蛛魔王:
if (space.AllRoles().Count == players.Count) {
Step = Steps.副本完成通过传送门离开;
space.MusicUri = "100";
space.AddAnimation(new AnimationBase() {
ID = 0,
Code = 81,
Position = new Point(-300, 1591),
Z = 1591,
Tip = "传送到【废墟秘境】",
Loop = true,
});
}
break;
}
}
/// <summary>
/// 开始倒计时
/// </summary>
void StartCountdown(Steps step, int remaining) {
countdownStep = Step = step;
secondsRemaining = remaining;
countdownTimer.Start();
}
/// <summary>
/// 倒计时
/// </summary>
protected override void Countdown(object sender, EventArgs e) {
if (Step != countdownStep) {
countdownTimer.Stop();
additionalInformation.Text = "";
} else {
additionalInformation.Text = string.Format("倒计时: {0}", secondsRemaining);
if (secondsRemaining == 0) {
additionalInformation.Text = "";
switch (Step) {
case Steps.十二秒内到达传送点:
case Steps.在23秒内为武器附上烟火粒子:
case Steps.在180秒内消灭蜘蛛魔王:
Exit("副本【猎杀蜘蛛魔王】 战斗失败");
break;
case Steps.等待4秒翼族来袭:
Step = Steps.消灭所有翼族;
AddRolesEvent(new AddRolesEventArgs() { Num = 10, Mode = 1, Profession = Professions.Archer, State = States.Riding, TacticAI = TacticAIs.GoalLeader });
break;
case Steps.等待3秒刺客来袭:
Step = Steps.消灭所有刺客;
AddRolesEvent(new AddRolesEventArgs() { Num = 30, Mode = 2, Profession = Professions.Assassin, State = States.Walking, TacticAI = TacticAIs.GoalLeader });
break;
}
}
secondsRemaining--;
}
}
void player0_PositionChanged(object sender, DependencyPropertyChangedEventArgs e) {
Point p = (Point)(e.NewValue);
int x = (int)p.X;
int y = (int)p.Y;
if ((x == 41 && y == 90) || (x == 40 && y == 91)) {
LeaveEvent(new LeaveEventArgs() { Destination = new Teleport() { Instance = InstanceTypes.None, ToSpace = 0, ToDirection = Directions.SouthEast, ToCoordinate = new Point(57, 28) } });
Dispose(this, null);
} else if (Step == Steps.十二秒内到达传送点 && x == 46 && y == 72) {
StartCountdown(Steps.等待4秒翼族来袭, 4);
} else if (Step == Steps.进入传送点到达山的彼岸 && x == 73 && y == 25) {
Step = Steps.设置右键魔法为7级陨石坠落;
} else if (Step == Steps.副本完成通过传送门离开 && ((x == 48 && y == 59) || (x == 48 && y == 58) || (x == 47 && y == 58))) {
LeaveEvent(new LeaveEventArgs() { Destination = new Teleport() { Instance = InstanceTypes.GodFam, ToSpace = 101, ToDirection = Directions.NorthWest, ToCoordinate = new Point(60, 44) } });
Dispose(this, null);
}
}