/*This is more of a placeholder for the moment. * Needs to be reworked to include the use of boss looted weapon classes. */ public string getAttack(Entity target, int attackPicked) { int totalDmg = 0; string msg1 = ""; for (int i = 0; i < attackNum; i++) { totalDmg += rand.Next(1, 7); } if (attackPicked == 0) { totalDmg += attack[0]; } else if (attackPicked == 1) { totalDmg += attack[1]; } else if (attackPicked == 2) { totalDmg += attack[2]; } target.setLife(-totalDmg); msg1 = string.Format("You hit {0} with \n{1} for {2} damage", target.getName(), atkName[attackPicked], totalDmg); return(msg1); }
public void PrintStats(Entity x) { Console.WriteLine(x.getName()); Console.WriteLine("___________"); Console.WriteLine("STRENGTH: {0}", x.stats.getStr()); Console.WriteLine("DEXTERITY: {0}", x.stats.getDex()); Console.WriteLine("CHARISMA: {0}", x.stats.getChr()); Console.WriteLine("LUCK: {0}", x.stats.getLck()); Console.WriteLine("___________"); }
//更新 //public bool UpdateProducts(int PID,int CategoryID,string Name,string Description) //{ // if (helper.ExcuteCommandInt("update Products set CategoryID=" + CategoryID + ",Name='" + Name + "',Description='" + Description + "' where PID=" + PID + "") > 0) // return true; // else // return false; //} public bool UpdateProducts(Entity.Products product) { if (helper.ExcuteCommandInt("update Products set CategoryID=" +product.getCategoryID()+ ",Name='" +product.getName()+ "',Description='" +product.getDescription()+ "' where PID=" + product.getPID() + "") > 0) return true; else return false; }
//新增 //public bool AddProduct(int CategoryID,string Name,string Description) { // if (helper.ExcuteCommandInt("insert into Products(CategoryID,Name,Description) values("+CategoryID+",'"+Name+"','"+Description+"')") > 0) // return true; // else // return false; //} public bool AddProduct(Entity.Products product) { //int CategoryID, string Name, string Description if (helper.ExcuteCommandInt("insert into Products(CategoryID,Name,Description) values(" + product.getCategoryID() + ",'" + product.getName()+ "','" +product.getDescription() + "')") > 0) return true; else return false; }
public override void fight(int damageDone, Entity enemy) { Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine("{0} did {1} damage to {2}", name, attack, enemy.getName()); MainEntry.space(); enemy.health -= attack; Console.ResetColor(); MainEntry.space(); getInfo(); }
protected override void constructed() { SceneNodeElement sceneNode = Owner.getElement(nodeName) as SceneNodeElement; if (sceneNode != null) { entity = sceneNode.getNodeObject(entityName) as Entity; } if (entity == null) { blacklist("No entity specified or entity is not found."); } originalRenderGroup = entity.getRenderQueueGroup(); if (subEntityIndex >= entity.getNumSubEntities()) { blacklist("Entity {0} only has {1} SubEntities. Index {2} is invalid.", entity.getName(), entity.getNumSubEntities(), subEntityIndex); } subEntity = entity.getSubEntity(subEntityIndex); baseMaterialName = subEntity.getMaterialName(); MaterialManager materialManager = MaterialManager.getInstance(); bool useDefinedMaterial = !(alphaMaterialName == null || alphaMaterialName.Equals(String.Empty)); if (useDefinedMaterial) { if (materialManager.resourceExists(alphaMaterialName)) { finalAlphaMaterialName = alphaMaterialName; } else { blacklist("A custom material {0} is defined that cannot be found. This object will not be able to be alpha controlled.", this.alphaMaterialName); } } else { if (materialManager.resourceExists(baseMaterialName + alphaSuffix)) { finalAlphaMaterialName = baseMaterialName + alphaSuffix; } else { blacklist("Cannot find automatic alpha material {0}. Please ensure one exists or define a custom alpha behavior.", baseMaterialName + alphaSuffix); } } setAlpha(currentAlpha); }
override public void DealDmg(Entity target, int dmg) { Debug.Log(this.name + "deals " + dmg + " damage to " + target.getName() + "!"); target.TakeDmg(dmg); }
protected override void constructed() { base.constructed(); SceneNodeElement sceneNode = Owner.getElement(nodeName) as SceneNodeElement; if (sceneNode != null) { entity = sceneNode.getNodeObject(entityName) as Entity; } if (entity == null) { blacklist("No entity specified or entity is not found."); } if (subEntityIndex >= entity.getNumSubEntities()) { blacklist("Entity {0} only has {1} SubEntities. Index {2} is invalid.", entity.getName(), entity.getNumSubEntities(), subEntityIndex); } subEntity = entity.getSubEntity(subEntityIndex); }
protected override void link() { SceneNodeElement sceneNode = Owner.getElement(nodeName) as SceneNodeElement; if (sceneNode == null) { blacklist("Could not find node {0}.", nodeName); } entity = sceneNode.getNodeObject(entityName) as Entity; if (entity == null) { blacklist("No entity specified or entity is not found."); } if (subEntityIndex >= entity.getNumSubEntities()) { blacklist("Entity {0} only has {1} SubEntities. Index {3} is invalid.", entity.getName(), entity.getNumSubEntities(), subEntityIndex); } subEntity = entity.getSubEntity(subEntityIndex); baseMaterialName = subEntity.getMaterialName(); MaterialManager materialManager = MaterialManager.getInstance(); String alphaMaterialName = baseMaterialName + alphaSuffix; if (materialManager.resourceExists(alphaMaterialName)) { finalAlphaMaterialName = alphaMaterialName; } else { blacklist("Cannot find automatic alpha material {0}. Please ensure one exists or define a custom alpha behavior.", alphaMaterialName); } }
public void applyDamage(Entity entity) { float damage = generateDamage(); Debug.Log(playerStats.getEntity().getName() + " aplica daño fisico = " + damage.ToString() + " a : " + entity.getName()); entity.getStats().takePhysicalDamage(damage); }
public void PrintEntity(Entity x) { Console.WriteLine("Behold, the mighty {0}, level: {1}, class: {2}, HP:{3}", x.getName(), x.getLevel(), x.getSpec(), x.getHp()); }
protected override void constructed() { transparencyStates = new List <TransparencyState>(); transparencyStates.Add(new TransparencyState(startingTransparency)); SceneNodeElement sceneNode = Owner.getElement(nodeName) as SceneNodeElement; if (sceneNode == null) { blacklist("Cannot find Node '{0}'", nodeName); } if (childNodeName != null && childNodeName != String.Empty) { sceneNode = sceneNode.findChildNode(childNodeName); if (sceneNode == null) { blacklist("Could not find child node '{0}' in node '{1}'.", childNodeName, nodeName); } } entity = sceneNode.getNodeObject(entityName) as Entity; if (entity == null) { if (entityName == null) { blacklist("entityName is Null"); } else { blacklist("Cannot find entity named '{0}' in node '{1}'.", entityName, nodeName); } } originalRenderGroup = entity.getRenderQueueGroup(); if (subEntityIndex >= entity.getNumSubEntities()) { blacklist("Entity '{0}' only has '{1}' SubEntities. Index '{2}' is invalid.", entity.getName(), entity.getNumSubEntities(), subEntityIndex); } subEntity = entity.getSubEntity(subEntityIndex); baseMaterialName = subEntity.getMaterialName(); MaterialManager materialManager = MaterialManager.getInstance(); bool useDefinedMaterial = !(alphaMaterialName == null || alphaMaterialName.Equals(String.Empty)); if (useDefinedMaterial) { if (materialManager.resourceExists(alphaMaterialName)) { finalAlphaMaterialName = alphaMaterialName; } else { blacklist("A custom material '{0}' is defined that cannot be found. This object will not be able to be alpha controlled.", this.alphaMaterialName); } } else { if (materialManager.resourceExists(baseMaterialName + alphaSuffix)) { finalAlphaMaterialName = baseMaterialName + alphaSuffix; } else { blacklist("Cannot find automatic alpha material '{0}'. Please ensure one exists or define a custom alpha behavior.", baseMaterialName + alphaSuffix); } } using (var mat = subEntity.getMaterial()) { usesVirtualTexture = TransparencyController.isVirtualTextureMaterial(mat.Value); if (!usesVirtualTexture) { entity.setVisibilityFlags(TransparencyController.HiddenVisibilityMask); } } TransparencyController.addTransparencyObject(this); applyAlphaToMaterial(getCurrentTransparency(activeTransparencyState)); }
//public abstract void OnPacket(Packet packet); //public abstract void OnEntity(Entity entity); //public abstract void OnEntityDestroy(EntityDestroy destroyInfo); internal void internalOnPacket(Packet packet) { Entity entity; switch (packet.rustID) { case Packet.Rust.Entities: ProtoBuf.Entity entityInfo; uint num = Entity.ParseEntity(packet, out entityInfo); if (entityInfo.autoturret != null) { Entity.CreateOrUpdate(num, entityInfo); return; } if (entityInfo.basePlayer != null) { Entity.CreateOrUpdate(num, entityInfo); return; } if (entityInfo.resource != null) { Entity.CreateOrUpdate(num, entityInfo); return; } if (entityInfo.buildingPrivilege != null) { Entity.CreateOrUpdate(num, entityInfo); return; } if (entityInfo.baseNPC != null) { Entity.CreateOrUpdate(num, entityInfo); return; } if (entityInfo.sleepingBag != null) { Entity.CreateOrUpdate(num, entityInfo); return; } if (entityInfo.miningQuarry != null) { Entity.CreateOrUpdate(num, entityInfo); return; } if (entityInfo.plantEntity != null) { Entity.CreateOrUpdate(num, entityInfo); return; } if (entityInfo.helicopter != null) { Entity.CreateOrUpdate(num, entityInfo); return; } if (entityInfo.landmine != null) { Entity.CreateOrUpdate(num, entityInfo); return; } if (entityInfo.autoturret != null) { Entity.CreateOrUpdate(num, entityInfo); return; } if (Entity.getName(entityInfo.baseNetworkable.prefabID) != "UnKnown") { Entity.CreateOrUpdate(num, entityInfo); return; } //if (entity != null) OnEntity(entity); return; case Packet.Rust.EntityPosition: List <Entity.EntityUpdate> updates = Entity.ParsePositions(packet); List <Entity> entities = null; if (updates.Count == 1) { entity = Entity.UpdatePosition(updates[0]); if (entity != null) { (entities = new List <Entity>()).Add(entity); } } else if (updates.Count > 1) { entities = Entity.UpdatePositions(updates); } //if (entities != null) entities.ForEach(item => OnEntity(item)); return; case Packet.Rust.EntityDestroy: EntityDestroy destroyInfo = new EntityDestroy(packet); Entity.CreateOrUpdate(destroyInfo); //OnEntityDestroy(destroyInfo); return; } //OnPacket(packet); }
public override void apply(Entity entity) { if (playerStats.getSp() >= cost) { playerStats.reduceSp(cost); Debug.Log(playerStats.getEntity().getName() + " aplica efecto: " + nameSpell + " a: " + entity.getName()); entity.getStats().applyEffect(effect.copy()); } }
void Update() { if (woodCount != null) woodCount.text = Game.wood.ToString(); if (stoneCount != null) stoneCount.text = Game.stone.ToString(); if (Input.GetMouseButtonDown(0) && InputEnabled) { RaycastHit hit; if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 1000f, /*villagerLayer))/**/ (1 << 0x09) | (1 << 0x0A))){ selected = hit.collider.GetComponent<Entity>(); if(selected!=null) detailName.text = selected.getName(); //details.SetActive(true); if (selected is Villager) { } } else { selected = null; //details.SetActive(false); } } if (day == 7) { if (!awaitingRitual) Attack(); } }
override public void onCollideWithEntity(Entity e) { Debug.Log("Collided with " + e.getName()); }