public stats Stats; /* Initial stats */ public monster(string name, int carry, int flags, stats stats) { Name = name; CarryProb = carry; Flags = flags; Stats = stats.Copy(); }
// Start is called before the first frame update void Start() { go = GameObject.FindGameObjectWithTag("Player"); player = go.GetComponent <Movement_player>(); playerstats = go.GetComponent <stats>(); }
private void Start() { tower = GetComponent <Tower>(); monsters = new List <GameObject>(); ROSTimer = ROS; stats = GetComponent <stats>(); }
//private GameObject weaponL; //private GameObject weaponR; // Use this for initialization void Start() { Stats = this.gameObject.GetComponent <stats>(); gamebits = this.gameObject.GetComponent <GameBits>(); //weaponL = (GameObject)gameObject.transform.Find("weaponL").gameObject; //weaponR = (GameObject)gameObject.transform.Find("weaponR").gameObject; }
public void attackFinished() { //attackDone = true; Collider2D hitBomb = Physics2D.OverlapCircle(hitSpace.transform.position, 0.3f, 1 << LayerMask.NameToLayer("Bomb")); if (hitBomb != null) { bombFunctions bomb = hitBomb.gameObject.GetComponent("bombFunctions") as bombFunctions; bomb.explode(); } Collider2D hit = Physics2D.OverlapCircle(hitSpace.transform.position, 0.40f, 1 << LayerMask.NameToLayer("Player")); if (hit != null) { if (blood != null) { GameObject b = (GameObject)Instantiate(blood); b.transform.position = new Vector2(hit.gameObject.transform.position.x, hit.gameObject.transform.position.y); Vector3 dir = transform.position - blood.transform.position; dir.z = 0; dir.Normalize(); float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg; b.transform.rotation = Quaternion.Slerp(blood.transform.rotation, Quaternion.Euler(0, 0, angle), 1f); } stats tStats = hit.gameObject.GetComponent("stats") as stats; tStats.damage(gameObject); } anim.SetBool("IsAttacking", false); }
public void enemystast(string mob) { stats _stat = null; switch (mob) { case "soldado": _stat = new soldado(); break; case "gato": _stat = new gatoputrefacto(); break; case "joven": _stat = new rebellista(); break; case "nino": _stat = new ninos(); break; case "Ratas": _stat = new ratas(); break; case "Papelon": _stat = new Papelon(); break; } lblenemyhp.Text = _stat.hp().ToString(); lblenemyatk.Text = _stat.atk().ToString(); lblenemydef.Text = _stat.def().ToString(); lblnombreenemigo.Text = _stat.nombre(); }
private string GetFileStatsHtml(stats s) { StringBuilder stats = new StringBuilder(); stats.AppendFormat("<p>{0}: <b>{1}</b></p>", "Total file in the queue", s.files_count); stats.AppendFormat("<p>{0}: <b>{1}</b></p>", "Total files size", Program.format_size_string(s.total_files_size)); if (s.board_stats.Count > 0) { stats.Append("<p><ul>"); foreach (KeyValuePair <string, int> v in s.board_stats) { stats.AppendFormat("<li>{0} file for /{1}/</li>", v.Value, v.Key); } stats.Append("</ul></p>"); } if (s.exts_stats.Count > 0) { stats.Append("<p><ul>"); foreach (KeyValuePair <string, int> v in s.exts_stats) { stats.AppendFormat("<li>{0} file is {1}</li>", v.Value, get_ext(v.Key)); } stats.Append("</ul></p>"); } return(stats.ToString()); }
public stats m_stats; /* Initial stats */ public monster(string mName, int mCarry, int mFlags, stats mStats) { m_name = mName; m_carry = mCarry; m_flags = mFlags; m_stats = mStats.Copy(); }
public int weakness(string nombre, int dmg, string weapon) { stats _stat = null; switch (nombre) { case "Soldado NormalS": _stat = new soldado(); break; case "gato": _stat = new gatoputrefacto(); break; case "joven": _stat = new rebellista(); break; case "nino": _stat = new ninos(); break; case "Ratas": _stat = new ratas(); break; case "Papelon": _stat = new Papelon(); break; } return(_stat.weakness(weapon, dmg)); }
private void Start() { monsters = new List <GameObject>(); bullets = new List <GameObject>(); ROFTimer = ROF; stats = GetComponent <stats>(); }
void EvaluateTurn(GameObject obj1, GameObject obj2) { stats _objstats1 = obj1.GetComponent <stats>(); stats _objstats2 = obj2.GetComponent <stats>(); int _agi1 = _objstats1.agi; int _agi2 = _objstats2.agi; if (combatPhase != 3) { if (_agi1 > _agi2) { attacker = obj1; target = obj2; } else { attacker = obj2; target = obj1; } } else { if (_agi1 < _agi2) { attacker = obj1; target = obj2; } else { attacker = obj2; target = obj1; } } }
Tuple <string, int> Seleccionar(string nombre, int numero) { stats _stat = null; switch (nombre) { case "Soldado NormalS": _stat = new soldado(); break; case "gato": _stat = new gatoputrefacto(); break; case "joven": _stat = new rebellista(); break; case "nino": _stat = new ninos(); break; case "Ratas": _stat = new ratas(); break; case "Papelon": _stat = new Papelon(); break; } return(Tuple.Create(_stat.Nameatk(numero).Item1, _stat.Nameatk(numero).Item2)); }
public float GetStat(stats stat) { switch (stat) { case stats.Attempts: return(_attempts); case stats.Crystals: return(_crystals); case stats.Jumps: return(_jumps); case stats.Metres: return(_metres); case stats.TimeSpend: return(_timeSpend); case stats.TimePerRun: return(_timePerRun); case stats.MetresPerRun: return(_metresPerRun); case stats.CrystalsPerRun: return(_crystalsPerRun); } return(404); }
// Use this for initialization void Start() { anim = GetComponent("Animator") as Animator; saved_cont = anim.runtimeAnimatorController; stat = gameObject.GetComponent("stats") as stats; stat.isPlayer = true; }
void Start() { doorColor = transform.parent.GetComponent <interactiveObject>().color; doorCol = transform.parent.GetComponent <BoxCollider2D>(); theDoor = transform.parent.GetComponent <door>(); playerStats = GameObject.FindWithTag("Player").GetComponent <stats>(); }
//private GameObject weaponL; //private GameObject weaponR; // Use this for initialization void Start() { Stats = this.gameObject.GetComponent<stats>(); gamebits = this.gameObject.GetComponent<GameBits>(); //weaponL = (GameObject)gameObject.transform.Find("weaponL").gameObject; //weaponR = (GameObject)gameObject.transform.Find("weaponR").gameObject; }
public statsForm(Game1 game) { InitializeComponent(); this.game = game; this.stats = this.game.getStats(); this.loadValues(); }
// Use this for initialization void Start() { lifeDelay = 2f; startTime = Time.time; Stats = this.gameObject.GetComponent <stats>(); ownerName = owner.name; owner = null; }
public poke(string readIn) //single arg constructor { name = readIn; ability = ""; type = ""; stats nums = new stats(); attacks atks = new attacks(); }
public poke() //default constructor { name = "null"; ability = "null"; type = "null"; stats nums = new stats(); attacks atks = new attacks(); }
// Use this for initialization void Start() { lifeDelay = 2f; startTime = Time.time; Stats = this.gameObject.GetComponent<stats>(); ownerName = owner.name; owner = null; }
void Start() { gameObject.GetComponent <SpriteRenderer>().sprite = normal; sT = FindObjectOfType <stats>(); sM = FindObjectOfType <spawnManager>(); sM2 = FindObjectOfType <spawnManager2>(); hasDied = false; }
public int upgradeCost(stats _stat) { int i = (int)(_stat); if (i < 0) { return((int)(0.05 * ShipInfo.ShipValue)); } return((int)(0.2 * ShipInfo.ShipPrice * Math.Exp(ShipInfo.upgrades[i]))); }
public void PickUpPowerUp() { Debug.Log("Picked up"); // Instantiate(PowerUpEffect, transform.position, transform.rotation); stats HealthIncrease = GameManager.FindObjectOfType <stats>(); stats.Health *= multipler; Destroy(gameObject); }
public Achievement(stats _stat, int _thresholdValue, string _header, string _text, Sprite _sprite, int _awardAmount) { stat = _stat; header = _header; text = _text; thresholdValue = _thresholdValue; sprite = _sprite; awardAmount = _awardAmount; }
public Character(string FirstName, string LastName, int Age, Race Race, Objects.Class Class, stats Stats, Form1 Form) { fName = FirstName; lName = LastName; charClass = Class; age = Age; race = Race; charStats = Stats; form = Form; }
// Use this for initialization void Start() { Cam_main = Camera.main; player = GameObject.FindWithTag("Player"); fov = player.GetComponent <FieldOfView>(); canvas = GetComponentInChildren <Canvas>().gameObject.transform; statistics = player.GetComponent <stats>(); zombiescript = GetComponent <ZombieScript>(); }
public static void SavePlayerInGame(stats player, string saveSlot) { BinaryFormatter formatter = new BinaryFormatter(); string path = Application.persistentDataPath + "/" + saveSlot + "pom.txt"; FileStream stream = new FileStream(path, FileMode.Create); Player_data_inGame data = new Player_data_inGame(player); formatter.Serialize(stream, data); stream.Close(); }
public void ResetAttack() //reset the values of the attack: { AttackStep = 0; AttackStepTimer = 0.0f; AttackTimer = 0.0f; AttackTarget = null; TargetUnit = null; TargetBuilding = null; TargetRpg = null; WasInTargetRange = false; }
//Set attack target: public void SetAttackTargetLocal(GameObject Obj) { //if the attacker is a unit: if (AttackerType == AttackerTypes.Unit) { UnitMgr.DestinationReached = false; //to make the unit move to the target. } LastTargetPos = Obj.transform.position; //If this is a different target than the last assigned: if (Obj != AttackTarget) { //Allow to play animation: CanPlayAnim = true; AttackTarget = Obj; TargetUnit = AttackTarget.GetComponent <Unit>(); TargetBuilding = AttackTarget.GetComponent <Building>(); TargetRpg = AttackTarget.GetComponent <stats>(); if (DirectAttack == false) { //other settings here: if (AttackType == AttackTypes.Random) { //if the attack type is random AttackStep = Random.Range(0, AttackSources.Length); //pick a random source } else if (AttackType == AttackTypes.InOrder) { //if it's in order AttackStep = 0; //start with the first attack source: } AttackStepTimer = AttackSources[AttackStep].AttackDelay; } WasInTargetRange = false; ReloadAttackDelay(); //new target, check to reload damage dealt; if (ReloadDamageDealt == true) { DamageDealt = 0.0f; } //Custom event: if (GameMgr.Events) { GameMgr.Events.OnAttackTargetLocked(this, AttackTarget); } } }
public void LaunchAttack(List <Unit> UnitsList, GameObject TargetObj, AttackModes AttackMode) { //if this is an online game if (GameManager.MultiplayerGame == true) { Debug.Log("entered here1"); //and this is the owner of the unit if (GameMgr.IsLocalPlayer(UnitsList[0].gameObject) == true) { stats rpgPlayer = null; if (TargetObj.GetComponent <SelectionObj>()) { rpgPlayer = TargetObj.GetComponent <SelectionObj>().MainObj.GetComponent <stats>(); } if (rpgPlayer) { if (UnitsList[0].team != rpgPlayer.Team && !rpgPlayer.DeadFlag) { Debug.Log("entered here3"); string unitIdString = InputManager.UnitListToString(UnitsList); // if (unitId >= 0) // { InputManager.UNET_Mgr.CmdAttackRpgList(unitIdString, TargetObj.GetComponent <SelectionObj>().MainObj.GetComponent <stats>().Team); // } } } else { //send input action to the input manager InputVars NewInputAction = new InputVars(); //mode: NewInputAction.SourceMode = (byte)InputSourceMode.Group; NewInputAction.TargetMode = (byte)InputTargetMode.Attack; //source NewInputAction.GroupSourceID = InputManager.UnitListToString(UnitsList); NewInputAction.Target = TargetObj; NewInputAction.Value = (int)AttackMode; //sent input InputManager.SendInput(NewInputAction); } } } else //single player game { //directly move the unit LaunchAttackLocal(UnitsList, TargetObj, AttackMode); } }
//Used when a base layout has been created defining the rooms of the maze. public void GenerateWithRooms(stats _params) { int tempD = _stats.mazeDepth, tempW = _stats.mazeWidth; _stats = _params; _stats.mazeDepth = tempD; _stats.mazeWidth = tempW; switch (_stats.generationMethod) { case mazeType.PRIMS: { generatePrims(); break; } case mazeType.KRUSKALS: { generateKruskals(); break; } case mazeType.RANDOM: { switch (Random.Range(0, 3)) { case 0: { generatePrims(); break; } case 1: { generateKruskals(); break; } case 2: { generateBackTracker(); break; } } break; } case mazeType.BACKTRACKER: { generateBackTracker(); break; } } clearWallsFromWorld(); drawMaze(); }
public snake(int _numCellsX, int _numCellsY, int _cellSize, int _direction, Graphics _snakeTable, bool _barrier, int[] _snakeBody) { numCells[0] = _numCellsX; numCells[1] = _numCellsY; cellSize = _cellSize; direction = _direction; snakeTable = _snakeTable; barrier = _barrier; snakeEat = new int[] { -1, -1 }; snakeEatMass = new int[] { -1, -1 }; foodGen = true; snakeBody.Add(_snakeBody); stata = new stats(); }
// Use this for initialization void Start() { playerCol = GetComponent <BoxCollider2D>(); stats = GetComponent <stats>(); jumps = 0; player = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); speed = 0.05f; keyCodes.Add(red, new KeyCode[] { KeyCode.RightArrow, KeyCode.LeftArrow, KeyCode.UpArrow, KeyCode.DownArrow }); keyCodes.Add(blue, new KeyCode[] { KeyCode.D, KeyCode.A, KeyCode.W, KeyCode.S }); controls = keyCodes[red]; swapTimer = 3.0f; }
public int finalDamage(stats target) { int armor; if (target.player != null) { armor = target.armor; foreach (GameObject item in target.player.inv.equipedItems) { if (item != null) armor += item.GetComponent<itemStats>().finalArmor; } } else { armor = target.armor; } if (armor > 200) armor = 200; if (armor < 0) armor = 0; return (baseDamage() * (1 - target.armor / 200)); }
//Works as a constructor void OnEnable() { //Set tooltips biasTooltip = new GUIContent("Bias Value", "Positive values bias towards horizontal, negative towards vertical"); wallRemovalTT = new GUIContent("Remove Selected Walls", "Remove the walls of a base layout that are selected in the scene window. \nCells either side of the wall can't be connected to the rest of the maze"); doorwayTT = new GUIContent("Designate Doorway", "Remove the walls of a base layout that are selected in the scene window. \nCells either side of the wall are able to be connected to the maze"); genWRoomsTT = new GUIContent("Generate With Rooms", "Generate a maze that includes user defined rooms. \nRequires Base Layout.\nUses width and depth defined during base layout creation"); generateTT = new GUIContent("Generate New Maze", "Creates a new maze, does not require a base layout to be created."); headerStyle = new GUIStyle(); showBiasFields = new AnimBool(); generator = new MazeGeneration(); param = new stats() { dBCurve = defineCurve(), useBias = false, wallMat = AssetDatabase.GetBuiltinExtraResource<Material>("Default-Diffuse.mat"), floorMat = AssetDatabase.GetBuiltinExtraResource<Material>("Default-Diffuse.mat") }; }
/// <summary> /// �g���b�N�X�^�[�̃N���C�A���g��Ď����A��莞�ԁu�����Ȃ��v�ɂȂ����ꍇ�� /// �����I����s�����ۂ̑I��ƁA�I���̏�����s���܂��B /// </summary> public void watcher() { status proc = WatchController.processWatch(); if(proc != status.End) { this.gameStats = stats.Start; // �N���� if (this.ProcessStatus != status.Running) { this.ProcessStatus = status.Running; //SimpleLogger.WriteLine("Trickster Client start..."); } /* * 1��ڂ̉����Ȃ����� * �����F1��ʼn����Ȃ��Ƃ݂Ȃ��Ȃ����R�́A�}�b�v�ړ���L�����N�^�[�f�[�^ * �ǂݍ��ݎ��ɂ�ꎞ�I�ɉ����Ȃ���ԂƂ��Č��o����Ă��܂����߁B */ if (proc == status.Stop) { // �����Ȃ����o�� SimpleLogger.WriteLine("detected hunged up trickster."); /* * ���o�������sleep�Փ˂ɂ��A�v���P�[�V�������̂̃n���O�A�b�v���̂��߁A * �ꎞ�I�Ƀ^�C�}�[���� */ //timer.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite); if (this.processStatus == status.Stop) return; this.ProcessStatus = status.Stop; SimpleLogger.WriteLine("sleep " + msec + "msec."); System.Threading.Thread.Sleep(msec); // sleep SimpleLogger.WriteLine("got up."); this.ProcessStatus = status.Running; proc = WatchController.processWatch(); if (proc == status.Running) { this.ProcessStatus = status.Running; SimpleLogger.WriteLine("detected to revive."); // �����̏ꍇ�͏C���ĊJ timer.Enabled = true; return; } /* * ���o臒l���ԕ�sleep���Ă�������Ȃ��ꍇ�� * �����ɉ����Ȃ��Ɣ��肷�� */ if (proc == status.Stop) { this.ProcessStatus = status.Stop; // �ꎞ�I��timer���� timer.Enabled = false; SimpleLogger.WriteLine("Trickster process is hunged up !!"); System.Windows.Forms.DialogResult MsgRes = System.Windows.Forms.MessageBox.Show("Trickster �̉����Ȃ�����o���܂����B" + Environment.NewLine + "�Q�[��������I�����܂����H", "Trickster Tools", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Warning, System.Windows.Forms.MessageBoxDefaultButton.Button2); if (MsgRes == System.Windows.Forms.DialogResult.Yes) { SimpleLogger.WriteLine("Trickster ProcessID: " + WatchController.TrickProcess.Id); try { WatchController.TrickProcess.Kill(); SimpleLogger.WriteLine("ProcessID: " + WatchController.TrickProcess.Id + " is killed."); this.ProcessStatus = status.ForceKilled; } catch (System.InvalidOperationException ioe) { SimpleLogger.WriteLine(ioe.Message); SimpleLogger.WriteLine("failed to kill " + WatchController.TrickProcess.Id); System.Windows.Forms.MessageBox.Show("�Q�[���̏I�������Ɏ��s���܂����B", "Trickster Tools", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } catch (System.SystemException se) { SimpleLogger.WriteLine(se.Message); SimpleLogger.WriteLine("failed to kill " + WatchController.TrickProcess.Id); System.Windows.Forms.MessageBox.Show(se.Message, "Exceptional error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); System.Windows.Forms.MessageBox.Show("�Q�[���̏I�������Ɏ��s���܂����B", "Trickster Tools", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } else { SimpleLogger.WriteLine("ignore hungup"); //this.hungCount = 0; this.ProcessStatus = status.Running; } timer.Enabled = true; } } } else { // �I���� // �N�������`�Ղ���������^�X�N�o�[�̕\������݂� if (this.gameStats == stats.Start && (this.ProcessStatus == status.Running || this.ProcessStatus == status.ForceKilled)) { SimpleLogger.WriteLine("try to recover taskbar."); ProgramController.showTaskBar(); } this.processStatus = status.End; this.gameStats = stats.Shutdown; } }
public stats LevelUp( int currentLevel, int currentRawHP, int currentRawMP, int currentRawMA, int currentRawPA, int currentRawSp ) { stats stats = new stats(); stats.rawHP += currentRawHP / (hpc + currentLevel); stats.HP = (int)multiply( (uint)stats.rawHP, hpm ); stats.rawMP += currentRawMP / (mpc + currentLevel); stats.MP = (int)multiply( (uint)stats.rawMP, mpm ); stats.rawMA += currentRawMA / (mac + currentLevel); stats.MA = (int)multiply( (uint)stats.rawMA, mam ); stats.rawPA += currentRawPA / (pac + currentLevel); stats.PA = (int)multiply( (uint)stats.rawPA, pam ); stats.rawSp += currentRawSp / (spc + currentLevel); stats.Sp = (int)multiply( (uint)stats.rawSp, spm ); return stats; }
private string GetFileStatsHtml(stats s) { StringBuilder stats = new StringBuilder(); stats.AppendFormat("<p>{0}: <b>{1}</b></p>", "Total file in the queue", s.files_count); stats.AppendFormat("<p>{0}: <b>{1}</b></p>", "Total files size", Program.format_size_string(s.total_files_size)); if (s.board_stats.Count > 0) { stats.Append("<p><ul>"); foreach (KeyValuePair<string, int> v in s.board_stats) { stats.AppendFormat("<li>{0} file for /{1}/</li>", v.Value, v.Key); } stats.Append("</ul></p>"); } if (s.exts_stats.Count > 0) { stats.Append("<p><ul>"); foreach (KeyValuePair<string, int> v in s.exts_stats) { stats.AppendFormat("<li>{0} file is {1}</li>", v.Value, get_ext(v.Key)); } stats.Append("</ul></p>"); } return stats.ToString(); }
// Use this for initialization void Start() { Stats = this.gameObject.GetComponent<stats>(); gamebits = this.gameObject.GetComponent<GameBits>(); }
//Construct Basic Layout public void constructBase(stats _params) { _stats = _params; createCells(); drawMaze(); }
//Main function public void Generate(stats _params) { _stats = _params; createCells(); //Chooses algorithm function switch (_stats.generationMethod) { case mazeType.PRIMS: { generatePrims(); break; } case mazeType.KRUSKALS: { generateKruskals(); break; } case mazeType.RANDOM: { switch (Random.Range(0,3)) { case 0: { generatePrims(); break; } case 1: { generateKruskals(); break; } case 2: { generateBackTracker(); break; } } break; } case mazeType.BACKTRACKER: { generateBackTracker(); break; } } drawMaze(); }
public stats m_stats; /* Initial stats */ #endregion Fields #region Constructors public monster(string mName, int mCarry, int mFlags, stats mStats) { m_name = mName; m_carry = mCarry; m_flags = mFlags; m_stats = mStats.Copy(); }
// Use this for initialization void Start() { Stats = this.gameObject.GetComponent<stats>(); Stats.moveFactor = 0f; }
public bool hitChance(stats target) { int hit = 75 + agility - target.agility; return (Random.Range(0, 100) <= hit); }
private void deleteLocalFiles(FileSystemDirectory level, stats st) { var nameIncludePattern = NameIncludePattern; var nameExcludePattern = NameExcludePattern; var canSize = level.FileSystem.InstanceCapabilities.SupportsFileSizes; var canModDates = level.FileSystem.InstanceCapabilities.SupportsLastAccessTimestamps; var min = MinSize; var max = MaxSize; var lmf = LastModifyFrom; var lmt = LastModifyTo; var lmah = LastModifyAgoHrs; var cutoffAgoDate = lmah.HasValue ? App.TimeSource.UTCNow.AddHours(-lmah.Value) : DateTime.MinValue; var fnames = level.FileNames; foreach(var fname in fnames) { st.FileCount++; if (nameIncludePattern!=null && !NFX.Parsing.Utils.MatchPattern(fname, nameIncludePattern)) continue; if (nameExcludePattern!=null && NFX.Parsing.Utils.MatchPattern(fname, nameExcludePattern)) continue; var file = level.GetFile(fname); if (file==null) continue; if (min.HasValue || max.HasValue) { if (canSize) { var size = file.Size; if (min.HasValue && size < min.Value) continue; if (max.HasValue && size > max.Value) continue; } else continue; } if (lmf.HasValue || lmt.HasValue || lmah.HasValue) { if (canModDates) { var fdt = file.ModificationTimestamp; if (fdt.HasValue) { if (lmf.HasValue && fdt.Value < lmf.Value) continue; if (lmt.HasValue && fdt.Value > lmt.Value) continue; if (lmah.HasValue && fdt.Value > cutoffAgoDate) continue; } } else continue; } file.Delete(); st.DelFileCount++; } }
// Use this for initialization void Start () { Stats = GameObject.Find ("_Gm").GetComponent<stats> (); stressMan = GameObject.Find ("_Gm").GetComponent<StressManager> (); }
public int finalDamage(stats target) { return (baseDamage() * (1 - target.armor / 200)); }
// Use this for initialization void Start() { exploTime = Time.time; Stats = this.gameObject.GetComponent<stats>(); }
public stats LevelDown( int currentLevel, int currentRawHP, int currentRawMP, int currentRawMA, int currentRawPA, int currentRawSp ) { stats stats = new stats(); stats.rawHP -= currentRawHP / (hpc + currentLevel - 1); stats.HP = multiply( (uint)stats.rawHP, hpm ); stats.rawMP -= currentRawMP / (mpc + currentLevel - 1); stats.MP = multiply( (uint)stats.rawMP, mpm ); stats.rawMA -= currentRawMA / (mac + currentLevel - 1); stats.MA = multiply( (uint)stats.rawMA, mam ); stats.rawPA -= currentRawPA / (pac + currentLevel - 1); stats.PA = multiply( (uint)stats.rawPA, pam ); stats.rawSp -= currentRawSp / (spc + currentLevel - 1); stats.Sp = multiply( (uint)stats.rawSp, spm ); return stats; }
private string GetFileQueueTableHtml(stats s) { StringBuilder sb = new StringBuilder(); var ordered = Program.queued_files.OrderByDescending(x => x.Value.Percent()); s.files_count = ordered.Count(); for (int index = 0; index < s.files_count; index++) { try { KeyValuePair<string, FileQueueStateInfo> kvp = ordered.ElementAt(index); FileQueueStateInfo f = kvp.Value; if ((!Settings.ListThumbsInQueue) && f.Type == FileQueueStateInfo.FileType.Thumbnail) { continue; } //sb.AppendFormat("<tr id='{0}'>", kvp.Key); sb.Append("<tr>"); sb.AppendFormat("<td>{0}</td>", get_file_status(f.Status)); sb.AppendFormat("<td>{0}</td>", f.RetryCount); sb.AppendFormat("<td>{0}</td>", get_type(f.Type)); sb.AppendFormat("<td>{0}</td>", f.Hash); if (f.Type == FileQueueStateInfo.FileType.FullFile) { sb.AppendFormat("<td>{0}</td>", Program.format_size_string(f.PostFile.size)); if (f.Status != FileQueueStateInfo.DownloadStatus.Complete || f.Status != FileQueueStateInfo.DownloadStatus.NotFound) { s.total_files_size += f.PostFile.size; } } else { sb.AppendFormat("<td>{0}</td>", Program.format_size_string(f.Length)); //complete files are not in the queue any more if (f.Status != FileQueueStateInfo.DownloadStatus.Complete || f.Status != FileQueueStateInfo.DownloadStatus.NotFound) { s.total_files_size += f.Length; } } sb.AppendFormat("<td>/{0}/</td>", f.PostFile.board); sb.AppendFormat("<td><code><a href='/boards/{0}/{1}'>{1}</a></code></td>", f.PostFile.board, f.PostFile.owner.OwnerThread.ID); sb.AppendFormat("<td><code><a href='/boards/{0}/{1}#p{2}'>{2}</a></code></td>", f.PostFile.board, f.PostFile.owner.OwnerThread.ID, f.PostFile.owner.ID); if (f.Type == FileQueueStateInfo.FileType.Thumbnail) { sb.Append("<td><span class=\"label label-info\">JPG</span></td>"); IncrementKey(s.exts_stats, "jpg"); } else { sb.AppendFormat("<td>{0}</td>", get_ext(f.PostFile.ext)); IncrementKey(s.exts_stats, f.PostFile.ext); } sb.AppendFormat("<td>{0} %</td>", Math.Round(f.Percent(), 2)); sb.AppendFormat("<td> <a href=\"/fileinfo/{0}\" class=\"label label-primary\">Info</a> </td>", kvp.Key); sb.AppendFormat("<td><span class=\"label label-primary\">{0}</span></td>", f.Type == FileQueueStateInfo.FileType.FullFile ? f.Priority.ToString().Replace("Level", "") : "N/A"); sb.Append("</tr>"); IncrementKey(s.board_stats, f.PostFile.board); } catch (Exception) { if (index >= Program.queued_files.Keys.Count) { break; } } } return sb.ToString(); }
private void doLevel(FileSystemDirectory level, stats st) { try { deleteLocalFiles(level, st); } catch(Exception localError) { log(MessageType.Error, "deleteLevel", "Deleting local files in '{0}'. Error: {1}".Args(level.Path, localError.ToMessageWithType(), localError)); } if (Recurse) { var sdNames = level.SubDirectoryNames; foreach(var sdName in sdNames) { if (!App.Active) return; var subdir = level.GetSubDirectory(sdName); if (subdir!=null) { st.DirCount++; doLevel(subdir, st); subdir.Dispose(); } if (DeleteEmptyDirs) { subdir = level.GetSubDirectory(sdName); if (subdir!=null) { var fcnt = subdir.FileNames.Count(); if (fcnt==0) { subdir.Delete(); st.DelDirCount++; } subdir.Dispose(); } } } } }
// Use this for initialization void Start() { exploTime = Time.time; Stats = this.gameObject.GetComponent<stats>(); gameObject.GetComponent<SphereCollider>().radius = 0f; }
protected override void DoFire() { FileSystem fs; FileSystemSessionConnectParams fsc; string fsr; lock(m_FSLock) { fs = m_FS; fsc = m_FSConnectParams; fsr = m_FSRootPath; } if (fs==null || fsc==null || fsr.IsNullOrWhiteSpace()) { log(MessageType.Warning, "DoFire()", "No FS"); return; } if (fs.InstanceCapabilities.IsReadonly) { log(MessageType.Error, "DoFire()", "Readonly FS: "+fs.GetType().Name); return; } //Delete files using(var session = fs.StartSession(fsc)) { var root = session[fsr] as FileSystemDirectory; if (root==null) { log(MessageType.Error, "DoFire()", "No FS root: {0}('{1}')".Args(fs.GetType().Name, fsr)); return; } var stats = new stats(); doLevel(root, stats); if (LogStats) log(MessageType.Info, "Run", "Scanned {0} files, {1} dirs; Deleted {2} files, {3} dirs".Args( stats.FileCount, stats.DirCount, stats.DelFileCount, stats.DelDirCount)); root.Dispose(); } }
public override bool Process(HttpServer.IHttpRequest request, HttpServer.IHttpResponse response, HttpServer.Sessions.IHttpSession session) { if (request.UriPath == Url || request.UriPath == (Url + "/")) { StringBuilder sb = new StringBuilder(HtmlTemplates.FileQueuePageTemplate); IncludeCommonHtml(sb); var stats = new stats(); sb.Replace("{{files-table}}", GetFileQueueTableHtml(stats)); sb.Replace("{{file-queue-statistics}}", GetFileStatsHtml(stats)); sb.Replace("{{settings-max-parallel-files-download}}", Program.file_stp.MaxThreads.ToString()); WriteFinalHtmlResponse(response, sb.ToString()); return true; } /*if (command == "/fq/list.txt") { StringBuilder sb = new StringBuilder(); var ordered = Program.queued_files; int count = ordered.Count(); for (int index = 0; index < count; index++) { try { KeyValuePair<string, FileQueueStateInfo> kvp = ordered.ElementAt(index); FileQueueStateInfo f = kvp.Value; if (f.Type == FileQueueStateInfo.FileType.Thumbnail) { continue; } sb.AppendFormat("<a href='{0}'>{0}</a><br/>", f.Url); } catch (Exception) { if (index >= Program.queued_files.Keys.Count) { break; } } } //write everything response.Status = System.Net.HttpStatusCode.OK; response.ContentType = "text/html"; byte[] data = Encoding.UTF8.GetBytes(sb.ToString()); response.ContentLength = data.Length; response.SendHeaders(); response.SendBody(data); return true; }*/ return false; }