public EnvironmentController(Scene scene) { this.scene = scene; world = new Target(scene); world.name = "神之手"; bossCollection = new BossCollection(scene); bossCollection.Init(); ItemPos = new List <Pos>(); if (scene.gameMode == Scene.GameMode.miuti) { ItemPos = MiutiModeItemPos; } //固定6个刷怪点 困难会极大增加刷新速度 spawnEnemyPos.Add(new Pos(1, 9)); spawnEnemyPos.Add(new Pos(1, 13)); spawnEnemyPos.Add(new Pos(12, 1)); spawnEnemyPos.Add(new Pos(12, 22)); spawnEnemyPos.Add(new Pos(31, 17)); spawnEnemyPos.Add(new Pos(31, 18)); foreach (var v in spawnEnemyPos) { Block bb = BlockFactory.CreateSpawn(); scene.blocks[v.x, v.y] = bb; } //Block b; //b = BlockFactory.CreateItem(); //b.name = "聚能手套"; //b.Pic = "➀"; //scene.blocks[ItemPos[0].x, ItemPos[0].y] = b; //b = BlockFactory.CreateItem(); //b.name = "聚能手套"; //b.Pic = "➀"; //scene.blocks[ItemPos[1].x, ItemPos[1].y] = b; //b = BlockFactory.CreateItem(); //b.name = "强能手套"; //b.Pic = "➁"; //scene.blocks[ItemPos[2].x, ItemPos[2].y] = b; //b = BlockFactory.CreateItem(); //b.name = "强能手套"; //b.Pic = "➁"; //scene.blocks[ItemPos[3].x, ItemPos[3].y] = b; //b = BlockFactory.CreateItem(); //b.name = "神杖"; //b.Pic = "⛏"; //scene.blocks[ItemPos[4].x, ItemPos[4].y] = b; //b = BlockFactory.CreateItem(); //b.name = "神杖"; //b.Pic = "⛏"; //scene.blocks[ItemPos[5].x, ItemPos[5].y] = b; //后两个门的位置 scene.blocks[32, 17] = BlockFactory.CreateDoor(); scene.blocks[32, 18] = BlockFactory.CreateDoor(); }
public void Action() { turns++; hugeHandCooldown--; crossFireCooldown--; if (bornFlag) { PointContinueTurns++; } //倒计时1释放火焰之地作为提醒 if (hugeHandCooldown == 1) { scene.environmentController.ShowMessageBox("泯灭神击!!!!!!!!"); foreach (var v in hugeHandRange) { Target t = scene.blocks[v.x, v.y].target; scene.blocks[v.x, v.y] = BlockFactory.CreateFire(); scene.blocks[v.x, v.y].target = t; } scene.Show(); } //如果神之掌击技能冷却完毕 if (hugeHandCooldown == 0) { List <Target> attackListPlayer = new List <Target>(); List <Target> attackListEnemy = new List <Target>(); List <Target> attackListOther = new List <Target>(); //获取攻击发起列表,去除指示器 foreach (var v in hugeHandRange) { Target t = scene.blocks[v.x, v.y].target; if (t != null) { //将t加入list进行下一步处理 攻击分类结算等等等 if (t.faction == Target.Faction.Enemy) { attackListEnemy.Add(t); } else if (t.faction == Target.Faction.Player) { attackListPlayer.Add(t); } else if (t.faction == Target.Faction.Friendly) { attackListOther.Add(t); } } scene.blocks[v.x, v.y] = BlockFactory.CreateGround(); scene.blocks[v.x, v.y].target = t; } int sum = attackListEnemy.Count + attackListOther.Count + attackListPlayer.Count; if (sum == 0) { sum = 1; } int attack = 0; if (scene.difficult == Scene.Difficult.easy) { attack = 400 + angry * 50; } else if (scene.difficult == Scene.Difficult.hard) { attack = 600 + angry * 100; } //每个敌人受到的伤害 int perAttack = attack / sum; //用来释放的技能 Skill s = Skill.CreateBoss1(perAttack, bossSelf); //它可能是被从控制器中移除了,单位应该是不会被销毁的 //int before = attackListEnemy.Count; //for (int i = attackListEnemy.Count-1;i>-1;--i) //{ // attackListEnemy[i].BeHit(s); //} foreach (var v in attackListEnemy) { v.BeHit(s); } //统计打死了几个敌人 int c = 0; foreach (var v in attackListEnemy) { if (v.isDead) { c++; } } //无论如何都要加一点愤怒,为了能够更快的刷新弱点攻击 angry++; angry += c; //石头直接打就行 foreach (var v in attackListOther) { v.BeHit(s); } if (attackListPlayer.Count > 0) { foreach (var v in attackListPlayer) { v.BeHit(s); } } //如果没有命中目标 else { //如果还有敌人可以打... 由于均摊数量太少,/2降低每次伤害 if (scene.playerController.lists.Count > 0) { perAttack = attack / scene.playerController.lists.Count / 2; //用来释放的技能 s = Skill.CreateBoss1(perAttack, bossSelf); List <Target> lists = scene.GetPlayers(); //处理交给第三方行动的单位 for (int i = lists.Count - 1; i > -1; i--) { lists[i].BeHit(s); } } } scene.AddDebugMessage("#R泯灭神击一共造成了" + attack.ToString() + "点伤害"); scene.Show(); //如果里面有己方英雄,对攻击范围内造成400+50*愤怒值的伤害 由所有单位均摊(不分敌友) 每杀死一个敌人会+1愤怒值 //如果里面没有己方英雄,追加一次神之掌击 对全屏造成400+5*愤怒值的伤害 由己方所有英雄均摊. hugeHandCooldown = 3; int count = 0; if (scene.difficult == Scene.Difficult.easy) { count = 1 + angry / 3; } if (scene.difficult == Scene.Difficult.hard) { count = 0 + angry / 5; } for (int i = 0; i < count; i++) { int r = scene.random.Next(0, bossList.Count - 1); bossList[r].isWeakness = true; bossList[r].colorActive = ConsoleColor.Red; bossList[r].pic = "■"; bossList[r].name = "弱点"; } scene.AddDebugMessage("震颤过后,boss露出了弱点,可以使用神杖攻击!"); } if (crossFireCooldown == 3) { scene.environmentController.ShowMessageBox("封锁烈焰!!!!!!!!!!"); foreach (var v in crossFireRange) { Target t = scene.blocks[v.x, v.y].target; scene.blocks[v.x, v.y] = BlockFactory.CreateFire(); scene.blocks[v.x, v.y].target = t; } scene.environmentController.ShowMessageBox("注意躲开脚下的火墙,会造成致命伤害"); } if (crossFireCooldown == 1) { scene.environmentController.ShowMessageBox("永远禁锢在火焰之中吧!"); foreach (var v in crossFireRange) { Target t = scene.blocks[v.x, v.y].target; if (t != null) { t.BeHit(Skill.CreateBoss1(1000, bossSelf)); } scene.blocks[v.x, v.y] = BlockFactory.CreateDoor(); } } if (crossFireCooldown == 0) { bornFlag = true; } if (bornFlag) { int during = 4; if (scene.difficult == Scene.Difficult.hard) { during = 8; } //普通持续4个回合 困难持续8个回合 if (PointContinueTurns == during) { scene.environmentController.ShowMessageBox("场地清除"); for (int y = 0; y < 10; y++) { for (int x = 0; x < 20; x++) { Target t = scene.blocks[33 + x, 10 + y].target; scene.blocks[33 + x, 10 + y] = BlockFactory.CreateGround(); scene.blocks[33 + x, 10 + y].target = t; } } bornFlag = false; } else { List <Pos> fireAera = new List <Pos>(); foreach (var v in bornEnemyPoint) { //搜索这个点可以移动的区域 //将三个点的所有扩展区域加入aera fireAera.AddRange(scene.ShowAera(v, PointContinueTurns, bossSelf.BFSSearchRoute)); } //将所有可移动区域创建为火焰之地 foreach (var v in fireAera) { Target t = scene.blocks[v.x, v.y].target; scene.blocks[v.x, v.y] = BlockFactory.CreateFire(); scene.blocks[v.x, v.y].target = t; //如果火焰之地的点上没有怪则按照几率刷新怪物 if (scene.blocks[v.x, v.y].target == null) { int r = scene.random.Next(1, 100); if (r < 2) { scene.enemyController.CreatKnight(v); } else if (r < 4) { scene.enemyController.CreateBoom(v); } else if (r < 10) { scene.enemyController.CreatGuard(v); } } } } } // public int hugeHandCooldown = 3; //public int crossFireCooldown = 5; //public int PointContinueTurns = 0; scene.AddDebugMessage("boss技能冷却:神击" + hugeHandCooldown.ToString() + "火墙" + crossFireCooldown.ToString() + "刷怪" + PointContinueTurns.ToString() + "愤怒" + angry.ToString()); /* 简单难度 极大增加封锁烈焰的冷却,只有开始时放一轮. 极大降低泯灭神击的愤怒值加成,将怪都拉进神击中击杀 * 封锁烈焰 第一个回合按照迷宫形状遍历txt 按照形状创建灼热之地,第二个回合按照形状先对目标的地点进行神之击秒杀站在上面的目标,然后造墙(红门贴图). * 第三个回合选取三个刷怪地点开始铺灼热地面并开始刷三种小怪.持续刷小怪,刷一轮大怪,隔一定时间刷炸弹. */ }
public void Action() { //本地计时器,如果符合条件就清0 levelTurns++; //直接反应在这测试 scene.turns = levelTurns; //执行场地效果结算 foreach (var v in scene.blocks) { if (v.name == "fire") { if (v.target != null) { if (v.target.faction == Target.Faction.Player) { v.target.BeHit(Skill.CreateFireGround(20, world)); } } } else if (v.name == "bastion") { if (v.target != null) { v.target.BeHit(Skill.CreateBastionRestore(20, world)); } } } foreach (var v in ItemPos) { Block b = scene.SelectBlock(v); if (b.target != null) { if (b.target.GetItem(b.name)) { DeleteItem(v.x, v.y, b.name); } } } //处理交给第三方行动的单位 for (int i = lists.Count - 1; i > -1; i--) { lists[i].Action(); } //第一个回合 if (scene.turns == 1 && state == State.begin) { Init(); scene.Show(); if (scene.difficult == Scene.Difficult.easy) { ShowMessageBox("欢迎来到战棋冒险的世界 [Enter]继续对话"); ShowMessageBox("操作说明:[q]取消 [空格]确认 [方向键]移动光标 [esc]结束当前回合 [1-4]释放技能"); scene.MoveCursor(new Pos(6, 6)); scene.Show(); ShowMessageBox("神杖是通关所需的关键装备,使用神杖的攻击可以击破特殊怪物的防御甲壳,不同角色携带神杖可以获得不同的神杖技能"); } else { ShowMessageBox("欢迎来到战棋冒险的世界 [Enter]继续对话"); ShowMessageBox("这里是丧心病狂的困难难度,为了帮助到达这里的勇士通关,下面是一些有助于通关的小tips"); ShowMessageBox("1.岩和寒的2技能造墙可以隔离敌人的视野,但是适当的留缝隙和反复堵迷宫可以改变敌人的行动路线,效果比堵死要好"); } ShowMessageBox("停在道具上可以在第二回合捡起道具,准备开始冒险吧!"); scene.AddDebugMessage("#C停在道具上可以在第二回合捡起道具"); scene.AddDebugMessage("#C捡起所有的道具,准备开始冒险吧!"); state = State.level1; } //是否开始了第一关 else if (state == State.level1) { scene.AddDebugMessage("剩余" + (levelContinuance - levelTurns).ToString() + "回合"); if (levelTurns == 2) { ShowMessageBox("♟卫士,普通敌人♞冲击骑士,第一次攻击造成巨量单体伤害"); } //每两个回合创造一次 if (levelTurns < 20 && levelTurns > 3 && levelTurns % 2 == 0) { foreach (var v in spawnEnemyPos) { if (scene.SelectBlock(v).target == null) { int r = scene.random.Next(0, 99); if (r < 20) { scene.enemyController.CreatKnight(v); } else { scene.enemyController.CreatGuard(v); } } else if (scene.SelectBlock(v).target.faction != Target.Faction.Enemy) { scene.SelectBlock(v).target.BeHit(Skill.CreateNormalDamage(100, world)); } } } if (levelTurns == 5) { ShowMessageBox("◉自爆球,贴近产生AOE自爆攻击.被神杖攻击过会破壳变成◎,此时可以正常受到伤害"); } if (levelTurns == 5 || levelTurns == 9 || levelTurns == 13 || levelTurns == 17) { foreach (var v in spawnEnemyPos) { if (scene.SelectBlock(v).target == null) { scene.enemyController.CreateBoom(v); } else if (scene.SelectBlock(v).target.faction != Target.Faction.Enemy) { scene.SelectBlock(v).target.BeHit(Skill.CreateNormalDamage(200, world)); } } } if (levelTurns == 7) { ShowMessageBox("♜重甲骑士,具有较高的生命值和攻击力"); } //疯狂刷新骑士 if (levelTurns == 7 || levelTurns == 11 || levelTurns == 15 || levelTurns == 19) { foreach (var v in spawnEnemyPos) { if (scene.SelectBlock(v).target == null) { scene.enemyController.CreatRook(v); } else if (scene.SelectBlock(v).target.faction != Target.Faction.Enemy) { scene.SelectBlock(v).target.BeHit(Skill.CreateNormalDamage(200, world)); } else { scene.SelectBlock(v).target.Dead(); scene.enemyController.CreatRook(v); } } } //该结束了 if (levelTurns == levelContinuance) { //打开后两个门 scene.blocks[32, 17] = BlockFactory.CreateGround(); scene.blocks[32, 18] = BlockFactory.CreateGround(); scene.MoveCursor(new Pos(32, 17) - scene.CursorPos); ShowMessageBox("大门已经打开,请加油通过吧!"); } if (levelTurns > levelContinuance) { bool isAllRight = true; foreach (var v in scene.playerController.lists) { if (v.location.x < 33) { isAllRight = false; } } //如果全部通过了 if (isAllRight) { ShowMessageBox("已经通过,正在封锁通道"); for (int i = scene.enemyController.lists.Count - 1; i > -1; i--) { if (scene.enemyController.lists[i].location.x < 33) { scene.MoveCursorTo(scene.enemyController.lists[i].location); scene.Show(); Thread.Sleep(300); scene.enemyController.lists[i].BeHit(Skill.CreateNormalDamage(1000, world)); } } ShowMessageBox("已经成功执行清扫"); Console.Clear(); //后两个门的位置 scene.blocks[32, 17] = BlockFactory.CreateDoor(); scene.blocks[32, 18] = BlockFactory.CreateDoor(); levelTurns = 0; state = State.level2; } } } //是否开始了第二关 else if (state == State.level2) { if (levelTurns == 1) { //片头动画 ShowMessageBox("~~~~~哇嘎嘎嘎嘎嘎嘎~~~~~~"); Console.Clear(); ShowBoss0(); ShowMessageBox("BUG之神:哇哈哈哈哈~来互相伤害啊"); BossAnimate(); ShowMessageBox("BUG之神:来啊,一起快活啊~嘎嘎嘎嘎嘎"); BossAnimate(); ShowBoss0(); ShowMessageBox("加油吧 骚年"); Console.Clear(); scene.canvas.InitUI(); scene.canvas.Refresh(); //直接把英雄传送过去 List <Pos> pl = new List <Pos>() { new Pos(38, 10), new Pos(40, 10), new Pos(42, 10), new Pos(44, 10), new Pos(46, 10) }; for (int i = 0; i < scene.playerController.lists.Count; i++) { scene.playerController.lists[i].MoveTo(pl[i]); scene.playerController.lists[i].changeHP(100); scene.playerController.lists[i].changeMP(100); scene.playerController.lists[i].changeAct(10); } scene.MoveCursorTo(new Pos(48, 6)); scene.Show(); ShowMessageBox("准备消灭BUG之神吧,BUG之神的任何部位都可以被攻击,其中红色的部位是弱点,用神杖点爆可以造成额外伤害"); foreach (var v in scene.GetPlayers()) { v.GetItem("神杖"); } } else { //之后每回合调用这个来进行boss的操作. bossCollection.Action(); } } void BossAnimate() { for (int i = 0; i < 5; i++) { ShowBoss0(); Thread.Sleep(100); ShowBoss2(); Thread.Sleep(100); ShowBoss1(); Thread.Sleep(100); ShowBoss2(); Thread.Sleep(100); } void ShowBoss1() { int x = 2, y = 1; foreach (var v in bossCollection.bossPic) { Console.SetCursorPosition(x, y); y++; string s = " " + v; Console.WriteLine(s); } } void ShowBoss2() { int x = 2, y = 1; foreach (var v in bossCollection.bossPic) { string s = ""; int a = scene.random.Next(0, 100); if (a < 30) { s = " " + v; } else if (a > 30 && a < 50) { s = " " + v; } else { s = v; } Console.SetCursorPosition(x, y); y++; Console.WriteLine(s); } } } void ShowBoss0() { int x = 2, y = 1; foreach (var v in bossCollection.bossPic) { Console.SetCursorPosition(x, y); y++; Console.WriteLine(v); } } }