codecombat安息之云山峰41关代码分享
2015-09-14 00:02
393 查看
codecombat中国游戏网址:http://www.codecombat.cn/
所有代码为javascript代码分享
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41、Summit's Gate
//需要一个好的操作
// Fight your way into the Inner Sanctum of the ogre chieftain, and kill her.
this.flags = function(){
var flagg = this.findFlag("green");
var flagb = this.findFlag("black");
if (flagg) {
this.pickUpFlag(flagg);
}
if (flagb) {
this.jumpTo(flagb.pos);
this.pickUpFlag(flagb);
}
};
this.attacks = function(){
var enemy = this.findNearest(this.findEnemies());
if (enemy && this.distanceTo(enemy) < 10) {
if (this.isReady("bash")) {
this.bash(enemy);
}
else if (this.isReady("throw")) {
this.throw(enemy);
}
else {
this.attack(enemy);
}
}
};
this.builds = function(){
if (this.gold > this.costOf("archer")) {
this.summon("archer");
}
};
this.comm = function(friend){
if (friend) {
var enemy = friend.findNearestEnemy();
if (friend.type == "paladin" && this.health < this.maxHealth) {
this.command(friend, "cast", "heal", this);
}
else if (enemy && enemy.type != "tower") {
this.command(friend, "attack", enemy);
}
else {
if (friend.pos.x < 240) {
this.command(friend, "move", {x:friend.pos.x+1,y:28});
}
}
}
};
this.commandFriends = function() {
// Command your friends.
var friends = this.findFriends();
for(var i=0; i < friends.length; i++) {
var friend = friends[i];
if(friend.type == "paladin") {
this.comm(friend);
}
else if (friend.type == "archer") {
this.comm(friend);
}
else if (friend.type == "soldier") {
this.comm(friend);
}
}
};
loop {
this.flags();
this.builds();
this.attacks();
this.commandFriends();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
所有代码为javascript代码分享
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41、Summit's Gate
//需要一个好的操作
// Fight your way into the Inner Sanctum of the ogre chieftain, and kill her.
this.flags = function(){
var flagg = this.findFlag("green");
var flagb = this.findFlag("black");
if (flagg) {
this.pickUpFlag(flagg);
}
if (flagb) {
this.jumpTo(flagb.pos);
this.pickUpFlag(flagb);
}
};
this.attacks = function(){
var enemy = this.findNearest(this.findEnemies());
if (enemy && this.distanceTo(enemy) < 10) {
if (this.isReady("bash")) {
this.bash(enemy);
}
else if (this.isReady("throw")) {
this.throw(enemy);
}
else {
this.attack(enemy);
}
}
};
this.builds = function(){
if (this.gold > this.costOf("archer")) {
this.summon("archer");
}
};
this.comm = function(friend){
if (friend) {
var enemy = friend.findNearestEnemy();
if (friend.type == "paladin" && this.health < this.maxHealth) {
this.command(friend, "cast", "heal", this);
}
else if (enemy && enemy.type != "tower") {
this.command(friend, "attack", enemy);
}
else {
if (friend.pos.x < 240) {
this.command(friend, "move", {x:friend.pos.x+1,y:28});
}
}
}
};
this.commandFriends = function() {
// Command your friends.
var friends = this.findFriends();
for(var i=0; i < friends.length; i++) {
var friend = friends[i];
if(friend.type == "paladin") {
this.comm(friend);
}
else if (friend.type == "archer") {
this.comm(friend);
}
else if (friend.type == "soldier") {
this.comm(friend);
}
}
};
loop {
this.flags();
this.builds();
this.attacks();
this.commandFriends();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
相关文章推荐
- Java记录 -32- 值交换
- struts2的select标签用法实例分析
- ASP.NET MVC5网站开发项目框架(二)
- ASP.NET MVC5 网站开发框架模型、数据存储、业务逻辑(三)
- ASP.NET MVC 5之邮件服务器与客户端
- PHP级联菜单,非AJAX版
- Django中扩展Paginator实现分页
- thinkphp query对%处理
- JRE,JDK和JVM的区别
- 图表制作工具TeeChart Pro VCL v2015.16发布【附下载】
- java基础教程视频
- c语言生成zigzag矩阵
- 使用Eclipse-Maven-git做Java开发(7)--maven概览
- Delphi XE10 精简 支持 Android 、 IOS 跨平台开发
- dubbo如何正确关闭Spring容器
- C#删除只读文件或文件夹(解决File.Delete无法删除文件)
- ld: i386 architecture of input file `exit.o' is incompatible with i386:x86-64 output
- 排序算法之冒泡算法
- 小白初学C++ PRIMER 第五版 第三章
- Java开发环境配置