├── app
├── .gitignore
├── app-release.apk
├── src
│ ├── main
│ │ ├── ic_launcher-web.png
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── football_icon.png
│ │ │ │ ├── main_menu_logo.png
│ │ │ │ ├── button_shape_fc_blue.xml
│ │ │ │ ├── button_shape_fc_neutral.xml
│ │ │ │ ├── button_shape_fc_win.xml
│ │ │ │ ├── button_shape_fc_accent.xml
│ │ │ │ ├── button_shape_fc_loss.xml
│ │ │ │ └── button_shape_fc.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── menu
│ │ │ │ ├── menu_home.xml
│ │ │ │ └── menu_main.xml
│ │ │ ├── values
│ │ │ │ ├── dimens.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ ├── simple_list_dialog.xml
│ │ │ │ ├── team_rankings_dialog.xml
│ │ │ │ ├── group_recruit.xml
│ │ │ │ ├── group_player_stats.xml
│ │ │ │ ├── team_history_list_item.xml
│ │ │ │ ├── news_story_list_item.xml
│ │ │ │ ├── team_lineup_list_item.xml
│ │ │ │ ├── injury_report.xml
│ │ │ │ ├── bowl_ccg_dialog.xml
│ │ │ │ ├── league_history_list_item.xml
│ │ │ │ ├── activity_home.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── activity_recruiting.xml
│ │ │ │ ├── child_player_stats.xml
│ │ │ │ ├── game_schedule_list_item.xml
│ │ │ │ ├── league_record_list_item.xml
│ │ │ │ ├── team_stats_list_item.xml
│ │ │ │ ├── hall_fame_list_item.xml
│ │ │ │ ├── activity_tutorial.xml
│ │ │ │ ├── team_rankings_list_item.xml
│ │ │ │ ├── child_recruit.xml
│ │ │ │ ├── team_lineup_dialog.xml
│ │ │ │ ├── team_strategy_dialog.xml
│ │ │ │ ├── content_recruiting.xml
│ │ │ │ ├── content_home.xml
│ │ │ │ ├── change_team_name_dialog.xml
│ │ │ │ ├── content_main.xml
│ │ │ │ ├── game_scout_dialog.xml
│ │ │ │ └── game_dialog.xml
│ │ ├── java
│ │ │ ├── CFBsimPack
│ │ │ │ ├── TeamStreak.java
│ │ │ │ ├── TeamStrategy.java
│ │ │ │ ├── Injury.java
│ │ │ │ ├── LeagueRecords.java
│ │ │ │ ├── Player.java
│ │ │ │ ├── PlayerOL.java
│ │ │ │ ├── PlayerCB.java
│ │ │ │ ├── PlayerS.java
│ │ │ │ ├── PlayerF7.java
│ │ │ │ └── PlayerRB.java
│ │ │ └── achijones
│ │ │ │ └── footballcoach
│ │ │ │ ├── NewsStoriesListArrayAdapter.java
│ │ │ │ ├── TeamStatsListArrayAdapter.java
│ │ │ │ ├── MockDraftListArrayAdapter.java
│ │ │ │ ├── HallOfFameListArrayAdapter.java
│ │ │ │ ├── SaveFilesListArrayAdapter.java
│ │ │ │ ├── LeagueHistoryListArrayAdapter.java
│ │ │ │ ├── LeagueRecordsListArrayAdapter.java
│ │ │ │ ├── SeasonAwardsListArrayAdapter.java
│ │ │ │ ├── TeamRankingsListArrayAdapter.java
│ │ │ │ ├── TutorialActivity.java
│ │ │ │ ├── GameScheduleListArrayAdapter.java
│ │ │ │ ├── TeamHistoryListArrayAdapter.java
│ │ │ │ ├── TeamLineupArrayAdapter.java
│ │ │ │ ├── PlayerStatsListArrayAdapter.java
│ │ │ │ ├── ExpandableListAdapterPlayerStats.java
│ │ │ │ └── Home.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── achijones
│ │ │ └── footballcoach
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── achijones
│ │ └── footballcoach
│ │ └── ApplicationTest.java
├── proguard-rules.pro
└── build.gradle
├── .idea
├── vcs.xml
├── modules.xml
└── runConfigurations.xml
└── README.md
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/app-release.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonesguy14/footballcoach/HEAD/app/app-release.apk
--------------------------------------------------------------------------------
/app/src/main/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonesguy14/footballcoach/HEAD/app/src/main/ic_launcher-web.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/football_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonesguy14/footballcoach/HEAD/app/src/main/res/drawable/football_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/main_menu_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonesguy14/footballcoach/HEAD/app/src/main/res/drawable/main_menu_logo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonesguy14/footballcoach/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonesguy14/footballcoach/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonesguy14/footballcoach/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonesguy14/footballcoach/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jonesguy14/footballcoach/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_home.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 |
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 | >
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/achijones/footballcoach/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.achijones.footballcoach;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/app/src/androidTest/java/achijones/footballcoach/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/simple_list_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Android\android-sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #00bb96
4 | #008066
5 | #ef6f10
6 | #cc6600
7 | #00ffcc
8 | #005ce6
9 | #1a75ff
10 | #b3ffb3
11 | #66ff66
12 | #ffb3b3
13 | #ff6666
14 | #d9d9d9
15 | #b3b3b3
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/team_rankings_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
18 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "achijones.footballcoach"
9 | minSdkVersion 19
10 | targetSdkVersion 23
11 | versionCode 32
12 | versionName "1.38"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:23.1.1'
26 | compile 'com.android.support:design:23.1.1'
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/group_recruit.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/group_player_stats.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/team_history_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/news_story_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/team_lineup_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/injury_report.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
18 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/bowl_ccg_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
20 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/league_history_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
21 |
22 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_recruiting.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/child_player_stats.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
19 |
20 |
26 |
27 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/game_schedule_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
22 |
23 |
32 |
--------------------------------------------------------------------------------
/app/src/main/java/CFBsimPack/TeamStreak.java:
--------------------------------------------------------------------------------
1 | package CFBsimPack;
2 |
3 | /**
4 | * Class used by Teams to keep track of the longest winning streaks in the league.
5 | * Created by Achi Jones on 3/19/2016.
6 | */
7 | public class TeamStreak {
8 |
9 | private int startYear;
10 | private int endYear;
11 | private int streakLength;
12 | private String streakTeam;
13 |
14 | public TeamStreak(int start, int end, int len, String t) {
15 | startYear = start;
16 | endYear = end;
17 | streakLength = len;
18 | streakTeam = t;
19 | }
20 |
21 | public void addWin(int year) {
22 | streakLength++;
23 | endYear = year;
24 | }
25 |
26 | public void resetStreak(int year) {
27 | startYear = year;
28 | endYear = year;
29 | streakLength = 0;
30 | }
31 |
32 | public void changeAbbr(String newAbbr) {
33 | streakTeam = newAbbr;
34 | }
35 |
36 | public int getStreakLength() {
37 | return streakLength;
38 | }
39 |
40 | public int getStartYear() {
41 | return startYear;
42 | }
43 |
44 | public int getEndYear() {
45 | return endYear;
46 | }
47 |
48 | public String getTeam() {
49 | return streakTeam;
50 | }
51 |
52 | public String getStreakCSV() {
53 | return streakLength + "," + streakTeam + "," + startYear + "," + endYear;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/league_record_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
16 |
25 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/team_stats_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
17 |
27 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/NewsStoriesListArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.ArrayAdapter;
8 | import android.widget.TextView;
9 |
10 | import achijones.footballcoach.R;
11 |
12 | import java.util.ArrayList;
13 |
14 | /**
15 | * Created by Achi on 3/1/2016.
16 | */
17 | public class NewsStoriesListArrayAdapter extends ArrayAdapter {
18 | private final Context context;
19 | private final ArrayList values;
20 |
21 | public NewsStoriesListArrayAdapter(Context context, ArrayList values) {
22 | super(context, R.layout.news_story_list_item, values);
23 | this.context = context;
24 | this.values = values;
25 | }
26 |
27 | @Override
28 | public View getView(int position, View convertView, ViewGroup parent) {
29 | LayoutInflater inflater = (LayoutInflater) context
30 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
31 | View rowView = inflater.inflate(R.layout.news_story_list_item, parent, false);
32 | TextView newsTitle = (TextView) rowView.findViewById(R.id.textNewsTitle);
33 | TextView newsContent = (TextView) rowView.findViewById(R.id.textNewsContent);
34 |
35 | String[] story = values.get(position).split(">");
36 | newsTitle.setText(story[0]);
37 | newsContent.setText(story[1]);
38 |
39 | return rowView;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/hall_fame_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
20 |
27 |
28 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/java/CFBsimPack/TeamStrategy.java:
--------------------------------------------------------------------------------
1 | package CFBsimPack;
2 |
3 | /**
4 | * Team Strategy class. It works for both offense and defense, just applying the bonus different ways.
5 | * Created by Achi Jones on 3/10/2016.
6 | */
7 | public class TeamStrategy {
8 |
9 | private int rushYdBonus;
10 | private int rushAgBonus;
11 | private int passYdBonus;
12 | private int passAgBonus;
13 |
14 | private String stratName;
15 | private String stratDescription;
16 |
17 | public TeamStrategy(String name, String descrip, int rYB, int rAB, int pYB, int pAB) {
18 | stratName = name;
19 | stratDescription = descrip;
20 | rushYdBonus = rYB;
21 | rushAgBonus = rAB;
22 | passYdBonus = pYB;
23 | passAgBonus = pAB;
24 | }
25 |
26 | public TeamStrategy() {
27 | stratName = "No Preference";
28 | stratDescription = "Will play a normal O/D with no bonus either way, but no penalties either.";
29 | rushYdBonus = 0;
30 | rushAgBonus = 0;
31 | passYdBonus = 0;
32 | passAgBonus = 0;
33 | }
34 |
35 | public String getStratName() {
36 | return stratName;
37 | }
38 |
39 | public String getStratDescription() {
40 | return stratDescription;
41 | }
42 |
43 | public int getRYB() {
44 | return rushYdBonus;
45 | }
46 |
47 | public int getRAB() {
48 | return rushAgBonus;
49 | }
50 |
51 | public int getPYB() {
52 | return passYdBonus;
53 | }
54 |
55 | public int getPAB() {
56 | return passAgBonus;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/TeamStatsListArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | /**
4 | * Created by Achi Jones on 2/20/2016.
5 | */
6 |
7 | import android.content.Context;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.ArrayAdapter;
12 | import android.widget.TextView;
13 |
14 | import achijones.footballcoach.R;
15 |
16 | public class TeamStatsListArrayAdapter extends ArrayAdapter {
17 | private final Context context;
18 | private final String[] values;
19 |
20 | public TeamStatsListArrayAdapter(Context context, String[] values) {
21 | super(context, R.layout.team_stats_list_item, values);
22 | this.context = context;
23 | this.values = values;
24 | }
25 |
26 | @Override
27 | public View getView(int position, View convertView, ViewGroup parent) {
28 | LayoutInflater inflater = (LayoutInflater) context
29 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
30 | View rowView = inflater.inflate(R.layout.team_stats_list_item, parent, false);
31 | TextView textLeft = (TextView) rowView.findViewById(R.id.textTeamStatsLeft);
32 | TextView textCenter = (TextView) rowView.findViewById(R.id.textTeamStatsCenter);
33 | TextView textRight = (TextView) rowView.findViewById(R.id.textTeamStatsRight);
34 |
35 | String[] teamStat = values[position].split(",");
36 | textLeft.setText(teamStat[0]);
37 | textCenter.setText(teamStat[1]);
38 | textRight.setText(teamStat[2]);
39 |
40 | return rowView;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_tutorial.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
18 |
19 |
20 |
28 |
29 |
33 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/team_rankings_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
15 |
21 |
28 |
29 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/java/CFBsimPack/Injury.java:
--------------------------------------------------------------------------------
1 | package CFBsimPack;
2 |
3 | import java.util.Random;
4 |
5 | /**
6 | * Injury class.
7 | * Each injured player has one.
8 | * Describes what the injury is, and how long it lasts.
9 | * Created by Achi Jones on 4/3/2016.
10 | */
11 | public class Injury {
12 |
13 | private int duration; // Duration of the injury (in games)
14 | private String description; // What the injury is
15 | private Player player; // Player that has this injury
16 |
17 | private static final String[] injuries = {"Knee", "Head", "Shoulder", "Wrist", "Ankle", "Foot", "Arm", "Back", "Brain"};
18 | private static final Random rando = new Random();
19 |
20 | public Injury(int dur, String descrip, Player p) {
21 | duration = dur;
22 | description = descrip;
23 | player = p;
24 | player.isInjured = true;
25 | }
26 |
27 | public Injury(Player p) {
28 | // Generate an injury
29 | duration = Math.abs((int)(rando.nextGaussian()*3 + 1));
30 | if (duration == 0) duration = 1;
31 | if (Math.random() < 0.01) duration = 15;
32 | description = injuries[ (int)(Math.random() * injuries.length) ];
33 | player = p;
34 | player.isInjured = true;
35 | }
36 |
37 | public int getDuration() {
38 | return duration;
39 | }
40 |
41 | public String getDescription() {
42 | return description;
43 | }
44 |
45 | public void advanceGame() {
46 | duration--;
47 | if (duration <= 0) {
48 | // Done with injury
49 | player.isInjured = false;
50 | player.injury = null;
51 | }
52 | }
53 |
54 | public String toString() {
55 | return description + " (" + duration + " wk)";
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
29 |
32 |
33 |
39 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/MockDraftListArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | /**
4 | * Created by Achi Jones on 2/20/2016.
5 | */
6 |
7 | import android.content.Context;
8 | import android.graphics.Color;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.ArrayAdapter;
13 | import android.widget.Button;
14 | import android.widget.TextView;
15 |
16 | import achijones.footballcoach.R;
17 |
18 | public class MockDraftListArrayAdapter extends ArrayAdapter {
19 | private final Context context;
20 | private final String[] values;
21 | private final String userTeamStrRep;
22 |
23 | public MockDraftListArrayAdapter(Context context, String[] values, String userTeamStrRep) {
24 | super(context, R.layout.child_player_stats, values);
25 | this.context = context;
26 | this.values = values;
27 | this.userTeamStrRep = userTeamStrRep;
28 | }
29 |
30 | @Override
31 | public View getView(int position, View convertView, ViewGroup parent) {
32 | LayoutInflater inflater = (LayoutInflater) context
33 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
34 | View rowView = inflater.inflate(R.layout.child_player_stats, parent, false);
35 |
36 | String[] detailSplit = values[position].split(">");
37 | TextView itemL = (TextView) rowView.findViewById(R.id.textPlayerStatsLeftChild);
38 | itemL.setText((1+position) + ". " + detailSplit[0]);
39 | TextView itemR = (TextView) rowView.findViewById(R.id.textPlayerStatsRightChild);
40 | itemR.setText(detailSplit[1]);
41 |
42 | Button butt = (Button) rowView.findViewById(R.id.buttonPlayerStatsViewAll);
43 | butt.setVisibility(View.GONE);
44 |
45 | if (detailSplit[1].equals(userTeamStrRep)) {
46 | itemL.setTextColor(Color.parseColor("#1A75FF"));
47 | itemR.setTextColor(Color.parseColor("#1A75FF"));
48 | }
49 |
50 | return rowView;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/button_shape_fc_blue.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
10 |
13 |
15 |
20 |
21 |
22 |
23 | -
24 |
25 |
29 |
32 |
34 |
39 |
40 |
41 |
42 | -
43 |
44 |
48 |
51 |
53 |
58 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/button_shape_fc_neutral.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
10 |
13 |
15 |
20 |
21 |
22 |
23 | -
24 |
25 |
29 |
32 |
34 |
39 |
40 |
41 |
42 | -
43 |
44 |
48 |
51 |
53 |
58 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/button_shape_fc_win.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
10 |
13 |
15 |
20 |
21 |
22 |
23 | -
24 |
25 |
29 |
32 |
34 |
39 |
40 |
41 |
42 | -
43 |
44 |
48 |
51 |
53 |
58 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/button_shape_fc_accent.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
10 |
13 |
15 |
20 |
21 |
22 |
23 | -
24 |
25 |
29 |
32 |
34 |
39 |
40 |
41 |
42 | -
43 |
44 |
48 |
51 |
53 |
58 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/button_shape_fc_loss.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
10 |
13 |
15 |
20 |
21 |
22 |
23 | -
24 |
25 |
29 |
32 |
34 |
39 |
40 |
41 |
42 | -
43 |
44 |
48 |
51 |
53 |
58 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/button_shape_fc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
10 |
13 |
15 |
20 |
21 |
22 |
23 | -
24 |
25 |
29 |
32 |
34 |
39 |
40 |
41 |
42 | -
43 |
44 |
48 |
51 |
53 |
58 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/HallOfFameListArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | /**
4 | * Created by Achi Jones on 3/29/2016.
5 | */
6 |
7 | import android.content.Context;
8 | import android.graphics.Color;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.ArrayAdapter;
13 | import android.widget.TextView;
14 |
15 | import achijones.footballcoach.R;
16 |
17 | public class HallOfFameListArrayAdapter extends ArrayAdapter {
18 | private final Context context;
19 | private final String[] values;
20 |
21 | public HallOfFameListArrayAdapter(Context context, String[] values) {
22 | super(context, R.layout.hall_fame_list_item, values);
23 | this.context = context;
24 | this.values = values;
25 | }
26 |
27 | @Override
28 | public View getView(int position, View convertView, ViewGroup parent) {
29 | LayoutInflater inflater = (LayoutInflater) context
30 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
31 | View rowView = inflater.inflate(R.layout.hall_fame_list_item, parent, false);
32 | TextView textTop = (TextView) rowView.findViewById(R.id.textViewHallFameName);
33 | TextView textLeft = (TextView) rowView.findViewById(R.id.textViewHallFameLeft);
34 | TextView textRight = (TextView) rowView.findViewById(R.id.textViewHallFameRight);
35 |
36 | String[] hof = values[position].split("&");
37 | if (hof.length > 1) {
38 | textTop.setText(hof[0]);
39 | StringBuilder left = new StringBuilder();
40 | StringBuilder right = new StringBuilder();
41 | for (int i = 1; i < hof.length; ++i) {
42 | String[] split = hof[i].split(">");
43 | left.append(split[0]);
44 | if (i != hof.length-1) left.append("\n");
45 | if (split.length > 1) {
46 | right.append(split[1]);
47 | if (i != hof.length-1) right.append("\n");
48 | }
49 | }
50 | textLeft.setText(left.toString());
51 | textRight.setText(right.toString());
52 | }
53 |
54 | return rowView;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/SaveFilesListArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | /**
4 | * Created by Achi Jones on 2/20/2016.
5 | */
6 |
7 | import android.content.Context;
8 | import android.graphics.Color;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.ArrayAdapter;
13 | import android.widget.Button;
14 | import android.widget.TextView;
15 |
16 | import achijones.footballcoach.R;
17 |
18 | public class SaveFilesListArrayAdapter extends ArrayAdapter {
19 | private final Context context;
20 | private final String[] values;
21 |
22 | public SaveFilesListArrayAdapter(Context context, String[] values) {
23 | super(context, R.layout.child_player_stats, values);
24 | this.context = context;
25 | this.values = values;
26 | }
27 |
28 | @Override
29 | public View getView(int position, View convertView, ViewGroup parent) {
30 | LayoutInflater inflater = (LayoutInflater) context
31 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
32 | View rowView = inflater.inflate(R.layout.child_player_stats, parent, false);
33 |
34 | Button butt = (Button) rowView.findViewById(R.id.buttonPlayerStatsViewAll);
35 | butt.setVisibility(View.GONE);
36 |
37 | String[] detailSplit = values[position].split(">");
38 | TextView itemL = (TextView) rowView.findViewById(R.id.textPlayerStatsLeftChild);
39 | itemL.setPadding(5,0,5,0);
40 | itemL.setText(detailSplit[0]);
41 | if (detailSplit.length >= 2) {
42 | TextView itemR = (TextView) rowView.findViewById(R.id.textPlayerStatsRightChild);
43 | itemR.setPadding(5,0,5,0);
44 | itemR.setText(detailSplit[1]);
45 | if (detailSplit[1].equals("[HARD]"))
46 | itemR.setTextColor(Color.RED);
47 | else itemR.setTextColor(Color.parseColor("#008066"));
48 | } else {
49 | TextView itemR = (TextView) rowView.findViewById(R.id.textPlayerStatsRightChild);
50 | itemR.setPadding(5,0,5,0);
51 | itemR.setText("[EASY]");
52 | itemR.setTextColor(Color.parseColor("#008066"));
53 | }
54 |
55 | return rowView;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/LeagueHistoryListArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | /**
4 | * Created by Achi Jones on 3/29/2016.
5 | */
6 |
7 | import android.content.Context;
8 | import android.graphics.Color;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.ArrayAdapter;
13 | import android.widget.TextView;
14 |
15 | import achijones.footballcoach.R;
16 |
17 | public class LeagueHistoryListArrayAdapter extends ArrayAdapter {
18 | private final Context context;
19 | private final String[] values;
20 | private String userTeamAbbr;
21 |
22 | public LeagueHistoryListArrayAdapter(Context context, String[] values, String userTeamAbbr) {
23 | super(context, R.layout.league_history_list_item, values);
24 | this.context = context;
25 | this.values = values;
26 | this.userTeamAbbr = userTeamAbbr;
27 | }
28 |
29 | @Override
30 | public View getView(int position, View convertView, ViewGroup parent) {
31 | LayoutInflater inflater = (LayoutInflater) context
32 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
33 | View rowView = inflater.inflate(R.layout.league_history_list_item, parent, false);
34 | TextView textTop = (TextView) rowView.findViewById(R.id.textViewLeagueHistoryTop);
35 | TextView textMiddle = (TextView) rowView.findViewById(R.id.textViewLeagueHistoryMiddle);
36 | TextView textBottom = (TextView) rowView.findViewById(R.id.textViewLeagueHistoryBottom);
37 |
38 | String[] record = values[position].split("\n");
39 | if (record.length == 3) {
40 | textTop.setText(record[0]);
41 | textMiddle.setText(record[1]);
42 | textBottom.setText(record[2]);
43 | if (record[1].split(" ")[1].equals(userTeamAbbr)) {
44 | // User team won NCG, make it special color
45 | textMiddle.setTextColor(Color.parseColor("#1A75FF"));
46 | }
47 | if (record[2].split(" ")[5].equals(userTeamAbbr)) {
48 | // User team won POTY, make it special color
49 | textBottom.setTextColor(Color.parseColor("#1A75FF"));
50 | }
51 | }
52 |
53 | return rowView;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/child_recruit.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
18 |
19 |
26 |
27 |
34 |
35 |
36 |
40 |
47 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/LeagueRecordsListArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | /**
4 | * Created by Achi Jones on 3/29/2016.
5 | */
6 |
7 | import android.content.Context;
8 | import android.graphics.Color;
9 | import android.util.TypedValue;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.ArrayAdapter;
14 | import android.widget.LinearLayout;
15 | import android.widget.TextView;
16 |
17 | import achijones.footballcoach.R;
18 |
19 | public class LeagueRecordsListArrayAdapter extends ArrayAdapter {
20 | private final Context context;
21 | private final String[] values;
22 | private final String userTeamAbbr;
23 |
24 | public LeagueRecordsListArrayAdapter(Context context, String[] values, String userTeamAbbr) {
25 | super(context, R.layout.league_record_list_item, values);
26 | this.context = context;
27 | this.values = values;
28 | this.userTeamAbbr = userTeamAbbr;
29 | }
30 |
31 | @Override
32 | public View getView(int position, View convertView, ViewGroup parent) {
33 | LayoutInflater inflater = (LayoutInflater) context
34 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
35 | View rowView = inflater.inflate(R.layout.league_record_list_item, parent, false);
36 | TextView textLeft = (TextView) rowView.findViewById(R.id.textLeagueRecordLeft);
37 | TextView textCenter = (TextView) rowView.findViewById(R.id.textLeagueRecordCenter);
38 | TextView textRight = (TextView) rowView.findViewById(R.id.textLeagueRecordRight);
39 |
40 | String[] record = values[position].split(",");
41 | if (record[1].equals("-1")) {
42 | textLeft.setText("");
43 | textCenter.setText(record[0]);
44 | textCenter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
45 | textRight.setText("");
46 | }
47 | else if (!record[2].equals("XXX")) {
48 | // Only show record if it exists
49 | textLeft.setText(record[1]);
50 | textCenter.setText(record[0]);
51 | textRight.setText(record[2] + "\n" + record[3]);
52 | if (record[2].split(" ")[0].equals(userTeamAbbr)) {
53 | // User team record, make it special color
54 | textRight.setTextColor(Color.parseColor("#1A75FF"));
55 | }
56 | }
57 |
58 | return rowView;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/SeasonAwardsListArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | /**
4 | * Created by Achi Jones on 4/18/2016.
5 | */
6 |
7 | import android.content.Context;
8 | import android.graphics.Color;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.ArrayAdapter;
13 | import android.widget.TextView;
14 |
15 | import achijones.footballcoach.R;
16 |
17 | public class SeasonAwardsListArrayAdapter extends ArrayAdapter {
18 | private final Context context;
19 | private final String[] values;
20 | private String userTeamAbbr;
21 |
22 | public SeasonAwardsListArrayAdapter(Context context, String[] values, String userTeamAbbr) {
23 | super(context, R.layout.league_history_list_item, values);
24 | this.context = context;
25 | this.values = values;
26 | this.userTeamAbbr = userTeamAbbr;
27 | }
28 |
29 | @Override
30 | public View getView(int position, View convertView, ViewGroup parent) {
31 | LayoutInflater inflater = (LayoutInflater) context
32 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
33 | View rowView = inflater.inflate(R.layout.league_history_list_item, parent, false);
34 | TextView textTop = (TextView) rowView.findViewById(R.id.textViewLeagueHistoryTop);
35 | TextView textMiddle = (TextView) rowView.findViewById(R.id.textViewLeagueHistoryMiddle);
36 | TextView textBottom = (TextView) rowView.findViewById(R.id.textViewLeagueHistoryBottom);
37 |
38 | String[] player = values[position].split("\n");
39 | if (player.length == 3) {
40 | textTop.setText(player[0]);
41 | textMiddle.setText(player[1]);
42 | textBottom.setText(player[2]);
43 | if (player[0].split("\\(")[0].equals(userTeamAbbr)) {
44 | // highlight user team players
45 | textTop.setTextColor(Color.parseColor("#1A75FF"));
46 | }
47 | } else if (player.length == 2) {
48 | textTop.setText(player[0]);
49 | textMiddle.setText(player[1]);
50 | textBottom.setVisibility(View.GONE);
51 | if (player[0].split("\\(")[0].equals(userTeamAbbr)) {
52 | // highlight user team players
53 | textTop.setTextColor(Color.parseColor("#1A75FF"));
54 | }
55 | } else {
56 | textMiddle.setText(values[position]);
57 | }
58 |
59 | return rowView;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/team_lineup_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
24 |
25 |
30 |
31 |
37 |
38 |
42 |
50 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/TeamRankingsListArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | /**
4 | * Created by Achi Jones on 2/20/2016.
5 | */
6 |
7 | import android.content.Context;
8 | import android.graphics.Color;
9 | import android.graphics.Typeface;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.ArrayAdapter;
14 | import android.widget.TextView;
15 |
16 | import achijones.footballcoach.R;
17 |
18 | import java.util.ArrayList;
19 |
20 | public class TeamRankingsListArrayAdapter extends ArrayAdapter {
21 | private final Context context;
22 | private final ArrayList values;
23 | private String userTeamStrRep;
24 |
25 | public TeamRankingsListArrayAdapter(Context context, ArrayList values, String userTeamStrRep) {
26 | super(context, R.layout.team_rankings_list_item, values);
27 | this.context = context;
28 | this.values = values;
29 | this.userTeamStrRep = userTeamStrRep;
30 | }
31 |
32 | @Override
33 | public View getView(int position, View convertView, ViewGroup parent) {
34 | LayoutInflater inflater = (LayoutInflater) context
35 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
36 | View rowView = inflater.inflate(R.layout.team_rankings_list_item, parent, false);
37 | TextView textLeft = (TextView) rowView.findViewById(R.id.textTeamRankingsLeft);
38 | TextView textCenter = (TextView) rowView.findViewById(R.id.textTeamRankingsCenter);
39 | TextView textRight = (TextView) rowView.findViewById(R.id.textTeamRankingsRight);
40 |
41 | String[] teamStat = values.get(position).split(",");
42 | textLeft.setText(teamStat[0]);
43 | textCenter.setText(teamStat[1]);
44 | textRight.setText(teamStat[2]);
45 |
46 | if (teamStat[1].equals(userTeamStrRep)) {
47 | // Bold user team
48 | textLeft.setTypeface(textLeft.getTypeface(), Typeface.BOLD);
49 | textLeft.setTextColor(Color.parseColor("#1A75FF"));
50 | textCenter.setTypeface(textCenter.getTypeface(), Typeface.BOLD);
51 | textCenter.setTextColor(Color.parseColor("#1A75FF"));
52 | textRight.setTypeface(textRight.getTypeface(), Typeface.BOLD);
53 | textRight.setTextColor(Color.parseColor("#1A75FF"));
54 | }
55 |
56 | return rowView;
57 | }
58 |
59 | public void setUserTeamStrRep(String userTeamStrRep) {
60 | this.userTeamStrRep = userTeamStrRep;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/TutorialActivity.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.support.v7.widget.Toolbar;
6 | import android.view.View;
7 | import android.widget.AdapterView;
8 | import android.widget.ArrayAdapter;
9 | import android.widget.Spinner;
10 | import android.widget.TextView;
11 |
12 | import java.util.ArrayList;
13 |
14 | public class TutorialActivity extends AppCompatActivity {
15 |
16 | Spinner tutorialSpinner;
17 | TextView tutorialTitle;
18 | TextView tutorialContent;
19 | ArrayList titles;
20 | ArrayList contents;
21 | ArrayAdapter dataAdapterTutorial;
22 |
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.activity_tutorial);
27 |
28 | tutorialSpinner = (Spinner) findViewById(R.id.tutorialSpinner);
29 | tutorialTitle = (TextView) findViewById(R.id.tutorialTitle);
30 | tutorialContent = (TextView) findViewById(R.id.tutorialContent);
31 |
32 | titles = new ArrayList<>();
33 | contents = new ArrayList<>();
34 |
35 | titles.add("Basics");
36 | contents.add(getString(R.string.tutBasics));
37 |
38 | titles.add("Playing a Season");
39 | contents.add(getString(R.string.tutPlayingSeason));
40 |
41 | titles.add("Rankings");
42 | contents.add(getString(R.string.tutRankings));
43 |
44 | titles.add("Roster");
45 | contents.add(getString(R.string.tutRoster));
46 |
47 | titles.add("Team Strategies");
48 | contents.add(getString(R.string.tutTeamStrategy));
49 |
50 | dataAdapterTutorial = new ArrayAdapter(this, android.R.layout.simple_spinner_item, titles);
51 | dataAdapterTutorial.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
52 | tutorialSpinner.setAdapter(dataAdapterTutorial);
53 | tutorialSpinner.setOnItemSelectedListener(
54 | new AdapterView.OnItemSelectedListener() {
55 | public void onItemSelected(
56 | AdapterView> parent, View view, int position, long id) {
57 | tutorialTitle.setText( titles.get(position) );
58 | tutorialContent.setText( contents.get(position) );
59 | }
60 |
61 | public void onNothingSelected(AdapterView> parent) {
62 | //heh
63 | }
64 | });
65 |
66 | }
67 |
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/team_strategy_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
21 |
26 |
27 |
28 |
35 |
36 |
41 |
49 |
54 |
55 |
56 |
64 |
65 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/GameScheduleListArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | /**
4 | * Created by Achi Jones on 2/21/2016.
5 | */
6 | import android.content.Context;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.ArrayAdapter;
11 | import android.widget.Button;
12 | import android.widget.TextView;
13 |
14 | import achijones.footballcoach.R;
15 |
16 | import CFBsimPack.Game;
17 | import CFBsimPack.Team;
18 |
19 | public class GameScheduleListArrayAdapter extends ArrayAdapter {
20 | private final Context context;
21 | private final Game[] games;
22 | private final Team team;
23 | private final MainActivity mainAct;
24 |
25 | public GameScheduleListArrayAdapter(Context context, MainActivity mainAct, Team team, Game[] games) {
26 | super(context, R.layout.game_schedule_list_item, games);
27 | this.context = context;
28 | this.mainAct = mainAct;
29 | this.games = games;
30 | this.team = team;
31 | }
32 |
33 | @Override
34 | public View getView(final int position, View convertView, ViewGroup parent) {
35 | LayoutInflater inflater = (LayoutInflater) context
36 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
37 | View rowView = inflater.inflate(R.layout.game_schedule_list_item, parent, false);
38 | TextView textLeft = (TextView) rowView.findViewById(R.id.gameScheduleLeft);
39 | Button gameButton = (Button) rowView.findViewById(R.id.gameScheduleButtonList);
40 | Button textRight = (Button) rowView.findViewById(R.id.gameScheduleRight);
41 |
42 | String[] gameSummary = team.getGameSummaryStr(position);
43 | textLeft.setText( gameSummary[0] );
44 | gameButton.setText( gameSummary[1] );
45 | textRight.setText( gameSummary[2] );
46 |
47 | if (team.gameWLSchedule.size() > position) {
48 | if (team.gameWLSchedule.get(position).equals("W")) {
49 | gameButton.setBackground(context.getResources().getDrawable(R.drawable.button_shape_fc_win));
50 | } else {
51 | gameButton.setBackground(context.getResources().getDrawable(R.drawable.button_shape_fc_loss));
52 | }
53 | }
54 |
55 | gameButton.setOnClickListener(new View.OnClickListener() {
56 | public void onClick(View v) {
57 | // Perform action on click
58 | mainAct.showGameDialog( games[position] );
59 | }
60 | });
61 |
62 | textRight.setOnClickListener(new View.OnClickListener() {
63 | @Override
64 | public void onClick(View v) {
65 | // Do something on click
66 | if (games[position].awayTeam == team)
67 | mainAct.examineTeam(games[position].homeTeam.name);
68 | else mainAct.examineTeam(games[position].awayTeam.name);
69 | }
70 | });
71 |
72 | return rowView;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/TeamHistoryListArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | /**
4 | * Created by Achi Jones on 4/17/2016.
5 | */
6 |
7 | import android.content.Context;
8 | import android.graphics.Color;
9 | import android.view.LayoutInflater;
10 | import android.view.View;
11 | import android.view.ViewGroup;
12 | import android.widget.ArrayAdapter;
13 | import android.widget.TextView;
14 |
15 | import java.util.Arrays;
16 | import java.util.List;
17 |
18 | import achijones.footballcoach.R;
19 |
20 | public class TeamHistoryListArrayAdapter extends ArrayAdapter {
21 | private final Context context;
22 | private final String[] values;
23 |
24 | public TeamHistoryListArrayAdapter(Context context, String[] values) {
25 | super(context, R.layout.team_history_list_item, values);
26 | this.context = context;
27 | this.values = values;
28 | }
29 |
30 | @Override
31 | public View getView(int position, View convertView, ViewGroup parent) {
32 | LayoutInflater inflater = (LayoutInflater) context
33 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
34 | View rowView = inflater.inflate(R.layout.team_history_list_item, parent, false);
35 | TextView textTop = (TextView) rowView.findViewById(R.id.textViewTeamHistoryTitle);
36 | TextView textBottom = (TextView) rowView.findViewById(R.id.textViewTeamHistoryDetail);
37 |
38 | String[] teamHist = values[position].split(">");
39 | if (teamHist.length > 1) {
40 | textTop.setText(teamHist[0]);
41 | String[] yearSplit = teamHist[0].split(" ");
42 | boolean wonNC = false, wonCC = false, wonB = false;
43 | for (String s : yearSplit) {
44 | if (s.equals("NCW")) wonNC = true;
45 | else if (s.equals("CC")) wonCC = true;
46 | else if (s.equals("BW")) wonB = true;
47 | }
48 |
49 | if (wonNC) textTop.setTextColor(Color.parseColor("#FF9933"));
50 | else if (wonCC) textTop.setTextColor(Color.parseColor("#00B300"));
51 | else if (wonB) textTop.setTextColor(Color.parseColor("#1A75FF"));
52 |
53 | String detail = "";
54 | for (int i = 1; i < teamHist.length; ++i) {
55 | detail += teamHist[i];
56 | if (i != teamHist.length - 1) detail += "\n";
57 | }
58 | textBottom.setText(detail);
59 | } else {
60 | textTop.setText(values[position]);
61 |
62 | String[] yearSplit = values[position].split(" ");
63 | boolean wonNC = false, wonCC = false, wonB = false;
64 | for (String s : yearSplit) {
65 | if (s.equals("NCW")) wonNC = true;
66 | else if (s.equals("CC")) wonCC = true;
67 | else if (s.equals("BW")) wonB = true;
68 | }
69 |
70 | if (wonNC) textTop.setTextColor(Color.parseColor("#FF9933"));
71 | else if (wonCC) textTop.setTextColor(Color.parseColor("#00B300"));
72 | else if (wonB) textTop.setTextColor(Color.parseColor("#1A75FF"));
73 |
74 | textBottom.setVisibility(View.GONE);
75 | }
76 |
77 | return rowView;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/TeamLineupArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.graphics.Typeface;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.ArrayAdapter;
10 | import android.widget.CheckBox;
11 | import android.widget.CompoundButton;
12 | import android.widget.TextView;
13 |
14 | import java.util.ArrayList;
15 |
16 | import CFBsimPack.Player;
17 |
18 | /**
19 | * Created by Achi Jones on 3/18/2016.
20 | */
21 | public class TeamLineupArrayAdapter extends ArrayAdapter {
22 | private final Context context;
23 | public final ArrayList players;
24 | public ArrayList playersSelected;
25 | public int playersRequired;
26 |
27 | public TeamLineupArrayAdapter(Context context, ArrayList values, int playersRequired) {
28 | super(context, R.layout.team_lineup_list_item, values);
29 | this.context = context;
30 | this.players = values;
31 | this.playersRequired = playersRequired;
32 | playersSelected = new ArrayList<>();
33 | for (int i = 0; i < playersRequired; ++i) {
34 | playersSelected.add( players.get(i) );
35 | }
36 | }
37 |
38 | @Override
39 | public View getView(final int position, View convertView, ViewGroup parent) {
40 | LayoutInflater inflater = (LayoutInflater) context
41 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
42 | View rowView = inflater.inflate(R.layout.team_lineup_list_item, parent, false);
43 |
44 | TextView playerInfo = (TextView) rowView.findViewById(R.id.textViewLineupPlayerInfo);
45 |
46 | if (players.get(position).injury == null) {
47 | playerInfo.setText(players.get(position).getInfoForLineup());
48 | } else {
49 | playerInfo.setText(players.get(position).getInfoLineupInjury());
50 | }
51 |
52 |
53 | CheckBox isPlayerStarting = (CheckBox) rowView.findViewById(R.id.checkboxPlayerStartingLineup);
54 | if (playersSelected.contains(players.get(position))) {
55 | isPlayerStarting.setChecked(true);
56 | } else if (players.get(position).year == 0) {
57 | // Is redshirt
58 | isPlayerStarting.setEnabled(false);
59 | playerInfo.setTextColor(Color.RED);
60 | } else if (players.get(position).isInjured) {
61 | // Is injured
62 | isPlayerStarting.setEnabled(false);
63 | playerInfo.setTextColor(Color.RED);
64 | } else {
65 | isPlayerStarting.setChecked(false);
66 | }
67 |
68 | isPlayerStarting.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
69 |
70 | @Override
71 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
72 | if (isChecked) {
73 | playersSelected.add(players.get(position));
74 | } else {
75 | playersSelected.remove(players.get(position));
76 | }
77 | }
78 | });
79 |
80 |
81 |
82 | return rowView;
83 |
84 |
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_recruiting.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
21 |
28 |
35 |
36 |
37 |
38 |
42 |
48 |
49 |
50 |
55 |
65 |
74 |
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_home.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
28 |
29 |
37 |
43 |
44 |
50 |
51 |
52 |
58 |
64 |
65 |
71 |
72 |
73 |
74 |
84 |
85 |
95 |
96 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/change_team_name_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
20 |
25 |
26 |
27 |
33 |
34 |
37 |
43 |
48 |
49 |
50 |
56 |
57 |
61 |
67 |
71 |
72 |
73 |
77 |
83 |
87 |
88 |
89 |
93 |
99 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/PlayerStatsListArrayAdapter.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | /**
4 | * Created by Achi Jones on 2/20/2016.
5 | */
6 |
7 | import android.content.Context;
8 | import android.graphics.Color;
9 | import android.graphics.Typeface;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.ArrayAdapter;
14 | import android.widget.Button;
15 | import android.widget.TextView;
16 |
17 | import achijones.footballcoach.R;
18 |
19 | public class PlayerStatsListArrayAdapter extends ArrayAdapter {
20 | private final Context context;
21 | private final String[] values;
22 |
23 | public PlayerStatsListArrayAdapter(Context context, String[] values) {
24 | super(context, R.layout.child_player_stats, values);
25 | this.context = context;
26 | this.values = values;
27 | }
28 |
29 | @Override
30 | public View getView(int position, View convertView, ViewGroup parent) {
31 | LayoutInflater inflater = (LayoutInflater) context
32 | .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
33 | View rowView = inflater.inflate(R.layout.child_player_stats, parent, false);
34 |
35 | /*String[] detailSplit = values[position].split(">");
36 | TextView itemL = (TextView) rowView.findViewById(R.id.textPlayerStatsLeftChild);
37 | itemL.setText(detailSplit[0]);
38 | TextView itemR = (TextView) rowView.findViewById(R.id.textPlayerStatsRightChild);
39 | itemR.setText(detailSplit[1]);*/
40 |
41 | String[] detailSplit = values[position].split(">");
42 | if (detailSplit.length == 2) {
43 | TextView itemL = (TextView) rowView.findViewById(R.id.textPlayerStatsLeftChild);
44 | TextView itemR = (TextView) rowView.findViewById(R.id.textPlayerStatsRightChild);
45 |
46 | if (values[position].substring(0,3).equals("[I]")) {
47 | // Injury, make red
48 | itemL.setText(detailSplit[0].substring(3));
49 | itemR.setText(detailSplit[1]);
50 | itemL.setTextColor(Color.RED);
51 | itemR.setTextColor(Color.RED);
52 | } else {
53 | itemL.setText(detailSplit[0]);
54 | itemR.setText(detailSplit[1]);
55 | colorizeRatings(itemL, detailSplit[0]);
56 | colorizeRatings(itemR, detailSplit[1]);
57 | }
58 |
59 | TextView itemC = (TextView) rowView.findViewById(R.id.textPlayerStatsCenter);
60 | itemC.setText("");
61 | } else {
62 | // Only one, center it
63 | TextView itemC = (TextView) rowView.findViewById(R.id.textPlayerStatsCenter);
64 | if (values[position].substring(0,3).equals("[B]")) {
65 | // Bold it
66 | itemC.setText(values[position].substring(3));
67 | itemC.setTypeface(null, Typeface.BOLD);
68 | } else if (values[position].substring(0,3).equals("[I]")) {
69 | // Red it for injury
70 | itemC.setText(values[position].substring(3));
71 | itemC.setTextColor(Color.RED);
72 | } else {
73 | itemC.setText(values[position]);
74 | }
75 |
76 | TextView itemL = (TextView) rowView.findViewById(R.id.textPlayerStatsLeftChild);
77 | itemL.setVisibility(View.GONE);
78 | TextView itemR = (TextView) rowView.findViewById(R.id.textPlayerStatsRightChild);
79 | itemR.setVisibility(View.GONE);
80 | }
81 |
82 | Button butt = (Button) rowView.findViewById(R.id.buttonPlayerStatsViewAll);
83 | butt.setVisibility(View.GONE);
84 |
85 | return rowView;
86 | }
87 |
88 | private void colorizeRatings(TextView textV, String rating) {
89 | String[] ratSplit = rating.split(" ");
90 | // The last index is always the rating: A+, C, etc
91 | if (ratSplit.length > 0 && rating.split(",").length == 1) {
92 | String letter = ratSplit[ratSplit.length - 1];
93 | if (letter.equals("A") || letter.equals("A+")) {
94 | textV.setTextColor(Color.parseColor("#006600"));
95 | } else if (letter.equals("B") || letter.equals("B+")) {
96 | textV.setTextColor(Color.parseColor("#00b300"));
97 | } else if (letter.equals("C") || letter.equals("C+")) {
98 | textV.setTextColor(Color.parseColor("#e68a00"));
99 | } else if (letter.equals("D") || letter.equals("D+")) {
100 | textV.setTextColor(Color.parseColor("#cc3300"));
101 | } else if (letter.equals("F") || letter.equals("F+")) {
102 | textV.setTextColor(Color.parseColor("#990000"));
103 | }
104 | }
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
21 |
22 |
29 |
36 |
41 |
46 |
47 |
56 |
62 |
68 |
74 |
80 |
81 |
86 |
92 |
93 |
99 |
100 |
106 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/game_scout_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
12 |
16 |
22 |
32 |
42 |
52 |
53 |
54 |
61 |
70 |
75 |
76 |
77 |
84 |
93 |
98 |
99 |
100 |
112 |
113 |
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/app/src/main/java/CFBsimPack/LeagueRecords.java:
--------------------------------------------------------------------------------
1 | package CFBsimPack;
2 |
3 | import java.util.ArrayList;
4 | import java.util.HashMap;
5 | import java.util.Map;
6 |
7 | /**
8 | * Class to hold all the all-time league season records like passing/rushing yards, TDs, etc
9 | * Created by Achi Jones on 3/19/2016.
10 | */
11 | public class LeagueRecords {
12 |
13 | public class Record {
14 | private int number;
15 | private String holder;
16 | private int year;
17 |
18 | public Record(int n, String h, int y) {
19 | number = n;
20 | holder = h;
21 | year = y;
22 | }
23 |
24 | public int getNumber() {
25 | return number;
26 | }
27 |
28 | public String getHolder() {
29 | return holder;
30 | }
31 |
32 | public int getYear() {
33 | return year;
34 | }
35 |
36 | private void changeAbbr(String newAbbr) {
37 | String[] split = holder.split(" ");
38 | holder = newAbbr;
39 | for (int i = 1; i < split.length; ++i) {
40 | holder += " " + split[i];
41 | }
42 | }
43 | }
44 |
45 | private HashMap records;
46 |
47 | public final String[] recordsList = {"TEAM","Team PPG","Team Opp PPG","Team YPG","Team Opp YPG","Team TO Diff",
48 | "SEASON","Pass Yards","Pass TDs","Interceptions","Comp Percent",
49 | "Rush Yards","Rush TDs","Rush Fumbles",
50 | "Rec Yards","Rec TDs","Catch Percent",
51 | "CAREER","Career Pass Yards","Career Pass TDs","Career Interceptions",
52 | "Career Rush Yards","Career Rush TDs","Career Rush Fumbles",
53 | "Career Rec Yards","Career Rec TDs"};
54 |
55 | public LeagueRecords(ArrayList recordStrings) {
56 | records = new HashMap();
57 | String[] csv;
58 | for (String str : recordStrings) {
59 | csv = str.split(",");
60 | records.put(csv[0], new Record(Integer.parseInt(csv[1]), csv[2], Integer.parseInt(csv[3])));
61 | }
62 | }
63 |
64 | public LeagueRecords() {
65 | records = new HashMap();
66 | records.put("TEAM", null);
67 | records.put("Team PPG", new Record(0, "XXX", 0));
68 | records.put("Team Opp PPG", new Record(1000, "XXX", 0));
69 | records.put("Team YPG", new Record(0, "XXX", 0));
70 | records.put("Team Opp YPG", new Record(1000, "XXX", 0));
71 | records.put("Team TO Diff", new Record(0, "XXX", 0));
72 | records.put("SEASON", null);
73 | records.put("Pass Yards", new Record(0, "XXX", 0));
74 | records.put("Pass TDs", new Record(0, "XXX", 0));
75 | records.put("Interceptions", new Record(0, "XXX", 0));
76 | records.put("Comp Percent", new Record(0, "XXX", 0));
77 | records.put("Rush Yards", new Record(0, "XXX", 0));
78 | records.put("Rush TDs", new Record(0, "XXX", 0));
79 | records.put("Rush Fumbles", new Record(0, "XXX", 0));
80 | records.put("Rec Yards", new Record(0, "XXX", 0));
81 | records.put("Rec TDs", new Record(0, "XXX", 0));
82 | records.put("Catch Percent", new Record(0, "XXX", 0));
83 | records.put("CAREER", null);
84 | records.put("Career Pass Yards", new Record(0, "XXX", 0));
85 | records.put("Career Pass TDs", new Record(0, "XXX", 0));
86 | records.put("Career Interceptions", new Record(0, "XXX", 0));
87 | records.put("Career Rush Yards", new Record(0, "XXX", 0));
88 | records.put("Career Rush TDs", new Record(0, "XXX", 0));
89 | records.put("Career Rush Fumbles", new Record(0, "XXX", 0));
90 | records.put("Career Rec Yards", new Record(0, "XXX", 0));
91 | records.put("Career Rec TDs", new Record(0, "XXX", 0));
92 | }
93 |
94 | public void checkRecord(String record, int number, String holder, int year) {
95 | if (record.equals("Team Opp PPG") || record.equals("Team Opp YPG")) {
96 | // Is a record where lower = better
97 | if ((records.containsKey(record) && number < records.get(record).getNumber())) {
98 | records.remove(record);
99 | records.put(record, new Record(number, holder, year));
100 | } else if (!records.containsKey(record)) {
101 | records.put(record, new Record(number, holder, year));
102 | }
103 | } else {
104 | // Is a record where higher = better
105 | if ((records.containsKey(record) && number > records.get(record).getNumber())) {
106 | records.remove(record);
107 | records.put(record, new Record(number, holder, year));
108 | } else if (!records.containsKey(record)) {
109 | records.put(record, new Record(number, holder, year));
110 | }
111 | }
112 | }
113 |
114 | public void changeAbbrRecords(String oldAbbr, String newAbbr) {
115 | Record r;
116 | for (String s : recordsList) {
117 | r = records.get(s);
118 | if (r != null && r.getHolder().split(" ")[0].equals(oldAbbr)) {
119 | r.changeAbbr(newAbbr);
120 | }
121 | }
122 | }
123 |
124 | public String getRecordsStr() {
125 | StringBuilder sb = new StringBuilder();
126 | for (String s : recordsList) {
127 | sb.append(recordStrCSV(s) + "\n");
128 | }
129 | return sb.toString();
130 | }
131 |
132 | private String recordStrCSV(String key) {
133 | if (records.containsKey(key)) {
134 | Record r = records.get(key);
135 | if (r == null) return key+",-1,-1,-1";
136 | return key+","+r.getNumber()+","+r.getHolder()+","+r.getYear();
137 | }
138 | else return "ERROR,ERROR,ERROR,ERROR";
139 | }
140 |
141 | /**
142 | * Print out string of all the records broken by a team that year
143 | * @return string of all records broken
144 | */
145 | public String brokenRecordsStr(int year, String abbr) {
146 | StringBuilder sb = new StringBuilder();
147 | for (Map.Entry r : records.entrySet()) {
148 | if (r.getValue() != null &&
149 | r.getValue().getHolder().split(" ")[0].equals(abbr) &&
150 | r.getValue().getYear() == year &&
151 | !r.getKey().split(" ")[0].equals("Career")) {
152 | sb.append(r.getValue().getHolder() + " broke the record for " +
153 | r.getKey() + " with " + r.getValue().getNumber() + "!\n");
154 | }
155 | }
156 |
157 | return sb.toString();
158 | }
159 |
160 | }
161 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/game_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
12 |
16 |
17 |
24 |
35 |
46 |
57 |
58 |
59 |
65 |
75 |
85 |
95 |
96 |
97 |
103 |
113 |
123 |
133 |
134 |
145 |
146 |
147 |
--------------------------------------------------------------------------------
/app/src/main/java/CFBsimPack/Player.java:
--------------------------------------------------------------------------------
1 | package CFBsimPack;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Vector;
5 |
6 | /**
7 | * Base player class that others extend. Has name, overall, potential, and football IQ.
8 | * @author Achi
9 | */
10 | public class Player {
11 |
12 | public Team team;
13 | public String name;
14 | public String position;
15 | public int year;
16 | public int ratOvr;
17 | public int ratPot;
18 | public int ratFootIQ;
19 | public int ratDur;
20 | public int ratImprovement;
21 | public int cost;
22 |
23 | public int gamesPlayed;
24 | public int statsWins;
25 | public boolean wonHeisman;
26 | public boolean wonAllAmerican;
27 | public boolean wonAllConference;
28 |
29 | public int careerGamesPlayed;
30 | public int careerHeismans;
31 | public int careerAllAmerican;
32 | public int careerAllConference;
33 | public int careerWins;
34 |
35 | public boolean isRedshirt;
36 |
37 | public boolean isInjured;
38 | public Injury injury;
39 |
40 | protected final String[] letterGrades = {"F", "F+", "D", "D+", "C", "C+", "B", "B+", "A", "A+"};
41 |
42 | public Vector ratingsVector;
43 |
44 | public String getYrStr() {
45 | if (year == 0) {
46 | return "RS";
47 | } else if ( year == 1 ) {
48 | return "Fr";
49 | } else if ( year == 2 ) {
50 | return "So";
51 | } else if ( year == 3 ) {
52 | return "Jr";
53 | } else if ( year == 4 ) {
54 | return "Sr";
55 | }
56 | return "ERROR";
57 | }
58 |
59 | public void advanceSeason() {
60 | //add stuff
61 | year++;
62 | }
63 |
64 | public int getHeismanScore() {
65 | int adjGames = gamesPlayed;
66 | if (adjGames > 10) adjGames = 10;
67 | return ratOvr * adjGames;
68 | }
69 |
70 | public String getInitialName() {
71 | String[] names = name.split(" ");
72 | return names[0].substring(0,1) + ". " + names[1];
73 | }
74 |
75 | public String getPosNameYrOvrPot_Str() {
76 | if (injury != null) {
77 | return "[I]" + position + " " + getInitialName() + " [" + getYrStr() + "] Ovr: " + ratOvr + ">" + injury.toString();
78 | }
79 | return position + " " + name + " [" + getYrStr() + "]>" + "Ovr: " + ratOvr + ", Pot: " + getLetterGrade(ratPot);
80 | }
81 |
82 | public String getPosNameYrOvrPot_OneLine() {
83 | if (injury != null) {
84 | return position + " " + getInitialName() + " [" + getYrStr() + "] Ovr: " + ratOvr + " " + injury.toString();
85 | }
86 | return position + " " + getInitialName() + " [" + getYrStr() + "] " + "Ovr: " + ratOvr + ", Pot: " + getLetterGrade(ratPot);
87 | }
88 |
89 | public String getPosNameYrOvr_Str() {
90 | return position + " " + name + " [" + getYrStr() + "] Ovr: " + ratOvr;
91 | }
92 |
93 | public String getYrOvrPot_Str() {
94 | return "[" + getYrStr() + "] Ovr: " + ratOvr + ", Pot: " + getLetterGrade(ratPot);
95 | }
96 |
97 | public String getPosNameYrOvrPot_NoInjury() {
98 | return position + " " + getInitialName() + " [" + getYrStr() + "] Ovr: " + ratOvr + ", Pot: " + getLetterGrade(ratPot);
99 | }
100 |
101 | public String getMockDraftStr() {
102 | return position + " " + getInitialName() + " [" + getYrStr() + "]>" + team.strRep();
103 | }
104 |
105 | /**
106 | * Convert a rating into a letter grade. 90 -> A, 80 -> B, etc
107 | */
108 | protected String getLetterGrade(String num) {
109 | int ind = (Integer.parseInt(num) - 50)/5;
110 | if (ind > 9) ind = 9;
111 | if (ind < 0) ind = 0;
112 | return letterGrades[ind];
113 | }
114 |
115 | /**
116 | * Convert a rating into a letter grade for potential, so 50 is a C instead of F
117 | */
118 | protected String getLetterGradePot(String num) {
119 | int ind = (Integer.parseInt(num))/10;
120 | if (ind > 9) ind = 9;
121 | if (ind < 0) ind = 0;
122 | return letterGrades[ind];
123 | }
124 |
125 | /**
126 | * Convert a rating into a letter grade. 90 -> A, 80 -> B, etc
127 | */
128 | protected String getLetterGrade(int num) {
129 | int ind = (num-50)/5;
130 | if (ind > 9) ind = 9;
131 | if (ind < 0) ind = 0;
132 | return letterGrades[ind];
133 | }
134 |
135 | /**
136 | * Convert a rating into a letter grade for potential, so 50 is a C instead of F
137 | */
138 | protected String getLetterGradePot(int num) {
139 | int ind = num/10;
140 | if (ind > 9) ind = 9;
141 | if (ind < 0) ind = 0;
142 | return letterGrades[ind];
143 | }
144 |
145 | public ArrayList getDetailStatsList(int games) {
146 | return null;
147 | }
148 |
149 | public ArrayList getDetailAllStatsList(int games) {
150 | return null;
151 | }
152 |
153 | public ArrayList getCareerStatsList() {
154 | ArrayList pStats = new ArrayList<>();
155 | pStats.add("Games: " + (gamesPlayed+careerGamesPlayed) + " (" + (statsWins+careerWins) + "-" + (gamesPlayed+careerGamesPlayed-(statsWins+careerWins)) + ")"
156 | + ">Yrs: " + getYearsPlayed());
157 | pStats.add("Awards: " + getAwards() + "> ");
158 | return pStats;
159 | }
160 |
161 | public String getYearsPlayed() {
162 | int startYear = team.league.getYear() - year + 1;
163 | int endYear = team.league.getYear();
164 | return startYear + "-" + endYear;
165 | }
166 |
167 | public String getAwards() {
168 | ArrayList awards = new ArrayList<>();
169 | int heis = careerHeismans + (wonHeisman ? 1 : 0);
170 | int aa = careerAllAmerican + (wonAllAmerican ? 1 : 0);
171 | int ac = careerAllConference + (wonAllConference ? 1 : 0);
172 | if (heis > 0) awards.add(heis + "x POTY");
173 | if (aa > 0) awards.add(aa + "x All-Amer");
174 | if (ac > 0) awards.add(ac + "x All-Conf");
175 |
176 | String awardsStr = "";
177 | for (int i = 0; i < awards.size(); ++i) {
178 | awardsStr += awards.get(i);
179 | if (i != awards.size()-1) awardsStr += ", ";
180 | }
181 |
182 | return awardsStr;
183 | }
184 |
185 | public String getInfoForLineup() {
186 | return null;
187 | }
188 |
189 | public String getInfoLineupInjury() {
190 | if (injury != null) {
191 | return getInitialName() + " [" + getYrStr() + "] " + injury.toString();
192 | }
193 | return getInitialName() + " [" + getYrStr() + "] " + "Ovr: " + ratOvr + ", Pot: " + getLetterGrade(ratPot);
194 | }
195 |
196 | public int getGamesPlayed() {
197 | if (gamesPlayed == 0) return 1;
198 | else return gamesPlayed;
199 | }
200 |
201 | public static int getPosNumber(String pos) {
202 | switch (pos) {
203 | case "QB": return 0;
204 | case "RB": return 1;
205 | case "WR": return 2;
206 | case "OL": return 3;
207 | case "K": return 4;
208 | case "S": return 5;
209 | case "CB": return 6;
210 | case "F7": return 7;
211 | default: return 8;
212 | }
213 | }
214 |
215 | }
216 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/ExpandableListAdapterPlayerStats.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | /**
4 | * Created by Achi Jones on 2/21/2016.
5 | */
6 |
7 | import android.app.Activity;
8 | import android.app.AlertDialog;
9 | import android.content.Context;
10 | import android.content.DialogInterface;
11 | import android.graphics.Color;
12 | import android.graphics.Typeface;
13 | import android.util.TypedValue;
14 | import android.view.LayoutInflater;
15 | import android.view.View;
16 | import android.view.ViewGroup;
17 | import android.widget.BaseExpandableListAdapter;
18 | import android.widget.Button;
19 | import android.widget.TextView;
20 |
21 | import achijones.footballcoach.R;
22 |
23 | import java.util.List;
24 | import java.util.Map;
25 |
26 | /**
27 | * Class used for the recruiting expandable list view
28 | */
29 | public class ExpandableListAdapterPlayerStats extends BaseExpandableListAdapter {
30 |
31 | private Activity context;
32 | private Map> playersInfo;
33 | private List players;
34 | private MainActivity mainAct;
35 |
36 | public ExpandableListAdapterPlayerStats(Activity context, MainActivity mainAct, List players, Map> playersInfo) {
37 | this.context = context;
38 | this.players = players;
39 | this.playersInfo = playersInfo;
40 | this.mainAct = mainAct;
41 | }
42 |
43 | public String getChild(int groupPosition, int childPosition) {
44 | return playersInfo.get(players.get(groupPosition)).get(childPosition);
45 | }
46 |
47 | public long getChildId(int groupPosition, int childPosition) {
48 | return childPosition;
49 | }
50 |
51 |
52 | public View getChildView(final int groupPosition, final int childPosition,
53 | boolean isLastChild, View convertView, ViewGroup parent) {
54 | final String playerDetail = getChild(groupPosition, childPosition);
55 | LayoutInflater inflater = context.getLayoutInflater();
56 |
57 | convertView = inflater.inflate(R.layout.child_player_stats, null);
58 |
59 | /* Set up Text for player details
60 | String[] detailSplit = playerDetail.split(">");
61 | TextView itemL = (TextView) convertView.findViewById(R.id.textPlayerStatsLeftChild);
62 | itemL.setText(detailSplit[0]);
63 | TextView itemR = (TextView) convertView.findViewById(R.id.textPlayerStatsRightChild);
64 | itemR.setText(detailSplit[1]);*/
65 |
66 | // Set up Text for player details
67 | TextView itemL = (TextView) convertView.findViewById(R.id.textPlayerStatsLeftChild);
68 | TextView itemR = (TextView) convertView.findViewById(R.id.textPlayerStatsRightChild);
69 | TextView itemC = (TextView) convertView.findViewById(R.id.textPlayerStatsCenter);
70 | itemC.setText("");
71 | itemL.setText("");
72 | itemR.setText("");
73 |
74 | String[] detailSplit = playerDetail.split(">");
75 | if (detailSplit.length == 2) {
76 | if (playerDetail.substring(0,3).equals("[I]")) {
77 | itemL.setText(detailSplit[0].substring(3));
78 | itemR.setText(detailSplit[1]);
79 | itemL.setTextColor(Color.RED);
80 | itemR.setTextColor(Color.RED);
81 | } else {
82 | itemL.setText(detailSplit[0]);
83 | itemR.setText(detailSplit[1]);
84 | colorizeRatings(itemL, detailSplit[0]);
85 | colorizeRatings(itemR, detailSplit[1]);
86 | }
87 | } else {
88 | // center
89 | itemC.setText(playerDetail);
90 | itemL.setVisibility(View.GONE);
91 | itemR.setVisibility(View.GONE);
92 | }
93 |
94 | Button buttonViewStats = (Button) convertView.findViewById(R.id.buttonPlayerStatsViewAll);
95 | buttonViewStats.setText("View Career Stats");
96 | buttonViewStats.setOnClickListener(new View.OnClickListener() {
97 | public void onClick(View view) {
98 | mainAct.examinePlayer(players.get(groupPosition));
99 | }
100 | });
101 |
102 | if (players.get(groupPosition).equals("BENCH > BENCH")) {
103 | /* Last group, meaning its the bench
104 | itemL.setOnClickListener(new View.OnClickListener() {
105 | public void onClick(View view) {
106 | mainAct.examinePlayer(playerDetail);
107 | }
108 | });*/
109 | buttonViewStats.setVisibility(View.GONE);
110 | } else {
111 | if (!isLastChild) buttonViewStats.setVisibility(View.GONE);
112 | else buttonViewStats.setVisibility(View.VISIBLE);
113 | itemL.setOnClickListener(null);
114 | }
115 |
116 | return convertView;
117 | }
118 |
119 | public int getChildrenCount(int groupPosition) {
120 | return playersInfo.get(players.get(groupPosition)).size();
121 | }
122 |
123 | public String getGroup(int groupPosition) {
124 | return players.get(groupPosition);
125 | }
126 |
127 | public int getGroupCount() {
128 | return players.size();
129 | }
130 |
131 | public long getGroupId(int groupPosition) {
132 | return groupPosition;
133 | }
134 |
135 | public View getGroupView(int groupPosition, boolean isExpanded,
136 | View convertView, ViewGroup parent) {
137 | LayoutInflater infalInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
138 | convertView = infalInflater.inflate(R.layout.group_player_stats, null);
139 |
140 | String[] detailSplit = getGroup(groupPosition).split(">");
141 | TextView itemL = (TextView) convertView.findViewById(R.id.textPlayerStatsLeft);
142 | itemL.setText(detailSplit[0]);
143 | itemL.setTypeface(null, Typeface.BOLD);
144 |
145 | TextView itemR = (TextView) convertView.findViewById(R.id.textPlayerStatsRight);
146 | itemR.setText(detailSplit[1]);
147 | itemR.setTypeface(null, Typeface.BOLD);
148 |
149 | // Highlight POTYs, All Americans, and All Conf players
150 | int playerAwards = 0;
151 | if (getGroup(groupPosition).equals("BENCH > BENCH")) playerAwards = 0;
152 | else playerAwards = mainAct.checkAwardPlayer(getGroup(groupPosition));
153 |
154 | if (playerAwards == 3) {
155 | // POTY
156 | itemL.setTextColor(Color.parseColor("#FF9933"));
157 | itemR.setTextColor(Color.parseColor("#FF9933"));
158 | }
159 | else if (playerAwards == 2) {
160 | // All American
161 | itemL.setTextColor(Color.parseColor("#1A75FF"));
162 | itemR.setTextColor(Color.parseColor("#1A75FF"));
163 | }
164 | else if (playerAwards == 1) {
165 | // All Conf
166 | itemL.setTextColor(Color.parseColor("#00B300"));
167 | itemR.setTextColor(Color.parseColor("#00B300"));
168 | }
169 |
170 | return convertView;
171 | }
172 |
173 | public boolean hasStableIds() {
174 | return true;
175 | }
176 |
177 | public boolean isChildSelectable(int groupPosition, int childPosition) {
178 | return true;
179 | }
180 |
181 | private void colorizeRatings(TextView textV, String rating) {
182 | String[] ratSplit = rating.split(" ");
183 | // The last index is always the rating: A+, C, etc
184 | if (ratSplit.length > 0 && rating.split(",").length == 1) {
185 | String letter = ratSplit[ratSplit.length - 1];
186 | if (letter.equals("A") || letter.equals("A+")) {
187 | textV.setTextColor(Color.parseColor("#006600"));
188 | } else if (letter.equals("B") || letter.equals("B+")) {
189 | textV.setTextColor(Color.parseColor("#00b300"));
190 | } else if (letter.equals("C") || letter.equals("C+")) {
191 | textV.setTextColor(Color.parseColor("#e68a00"));
192 | } else if (letter.equals("D") || letter.equals("D+")) {
193 | textV.setTextColor(Color.parseColor("#cc3300"));
194 | } else if (letter.equals("F") || letter.equals("F+")) {
195 | textV.setTextColor(Color.parseColor("#990000"));
196 | }
197 | }
198 | }
199 |
200 | } //end class
201 |
--------------------------------------------------------------------------------
/app/src/main/java/CFBsimPack/PlayerOL.java:
--------------------------------------------------------------------------------
1 | package CFBsimPack;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Vector;
5 |
6 | /**
7 | * Class for the OL player. 5 on field at a time.
8 | * @author Achi
9 | */
10 | public class PlayerOL extends Player {
11 |
12 | //public String name;
13 | //Overall rating, combination of other ratings
14 | //public int ratOvr;
15 | //Potential, affects how much he gets better in offseason
16 | //public int ratPot;
17 | //FootIQ, affects how smart he plays
18 | //public int ratFootIQ;
19 | //OLPow affects how strong he is against defending DL
20 | public int ratOLPow;
21 | //OLBkR affects how well he blocks for running plays
22 | public int ratOLBkR;
23 | //OLBkP affects how well he blocks for passing plays
24 | public int ratOLBkP;
25 |
26 | //public Vector ratingsVector;
27 |
28 | public PlayerOL( String nm, Team t, int yr, int pot, int iq, int pow, int bkr, int bkp, boolean rs, int dur ) {
29 | team = t;
30 | name = nm;
31 | year = yr;
32 | gamesPlayed = 0;
33 | isInjured = false;
34 | ratOvr = (pow*3 + bkr + bkp)/5;
35 | ratPot = pot;
36 | ratFootIQ = iq;
37 | ratDur = dur;
38 | ratOLPow = pow;
39 | ratOLBkR = bkr;
40 | ratOLBkP = bkp;
41 | isRedshirt = rs;
42 | if (isRedshirt) year = 0;
43 | position = "OL";
44 |
45 | cost = (int)(Math.pow((float)ratOvr - 55,2)/4) + 50 + (int)(Math.random()*100) - 50;
46 |
47 | ratingsVector = new Vector();
48 | ratingsVector.addElement(name+" ("+getYrStr()+")");
49 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
50 | ratingsVector.addElement(ratPot);
51 | ratingsVector.addElement(ratFootIQ);
52 | ratingsVector.addElement(ratOLPow);
53 | ratingsVector.addElement(ratOLBkR);
54 | ratingsVector.addElement(ratOLBkP);
55 |
56 | wonHeisman = false;
57 | wonAllAmerican = false;
58 | wonAllConference = false;
59 | statsWins = 0;
60 |
61 | careerGamesPlayed = 0;
62 | careerHeismans = 0;
63 | careerAllAmerican = 0;
64 | careerAllConference = 0;
65 | careerWins = 0;
66 | }
67 |
68 | public PlayerOL( String nm, Team t, int yr, int pot, int iq, int pow, int bkr, int bkp, boolean rs, int dur,
69 | int cGamesPlayed, int cHeismans, int cAA, int cAC, int cWins ) {
70 | team = t;
71 | name = nm;
72 | year = yr;
73 | gamesPlayed = 0;
74 | isInjured = false;
75 | ratOvr = (pow*3 + bkr + bkp)/5;
76 | ratPot = pot;
77 | ratFootIQ = iq;
78 | ratDur = dur;
79 | ratOLPow = pow;
80 | ratOLBkR = bkr;
81 | ratOLBkP = bkp;
82 | isRedshirt = rs;
83 | if (isRedshirt) year = 0;
84 | position = "OL";
85 |
86 | cost = (int)(Math.pow((float)ratOvr - 55,2)/4) + 50 + (int)(Math.random()*100) - 50;
87 |
88 | ratingsVector = new Vector();
89 | ratingsVector.addElement(name+" ("+getYrStr()+")");
90 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
91 | ratingsVector.addElement(ratPot);
92 | ratingsVector.addElement(ratFootIQ);
93 | ratingsVector.addElement(ratOLPow);
94 | ratingsVector.addElement(ratOLBkR);
95 | ratingsVector.addElement(ratOLBkP);
96 |
97 | wonHeisman = false;
98 | wonAllAmerican = false;
99 | wonAllConference = false;
100 | statsWins = 0;
101 |
102 | careerGamesPlayed = cGamesPlayed;
103 | careerHeismans = cHeismans;
104 | careerAllAmerican = cAA;
105 | careerAllConference = cAC;
106 | careerWins = cWins;
107 | }
108 |
109 | public PlayerOL( String nm, int yr, int stars, Team t ) {
110 | name = nm;
111 | year = yr;
112 | team = t;
113 | gamesPlayed = 0;
114 | isInjured = false;
115 | ratPot = (int) (50 + 50*Math.random());
116 | ratFootIQ = (int) (50 + 50*Math.random());
117 | ratDur = (int) (50 + 50*Math.random());
118 | ratOLPow = (int) (60 + year*5 + stars*5 - 25*Math.random());
119 | ratOLBkR = (int) (60 + year*5 + stars*5 - 25*Math.random());
120 | ratOLBkP = (int) (60 + year*5 + stars*5 - 25*Math.random());
121 | ratOvr = (ratOLPow*3 + ratOLBkR + ratOLBkP)/5;
122 | position = "OL";
123 |
124 | cost = (int)(Math.pow((float)ratOvr - 55,2)/4) + 50 + (int)(Math.random()*100) - 50;
125 |
126 | ratingsVector = new Vector();
127 | ratingsVector.addElement(name+" ("+getYrStr()+")");
128 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
129 | ratingsVector.addElement(ratPot);
130 | ratingsVector.addElement(ratFootIQ);
131 | ratingsVector.addElement(ratOLPow);
132 | ratingsVector.addElement(ratOLBkR);
133 | ratingsVector.addElement(ratOLBkP);
134 |
135 | wonHeisman = false;
136 | wonAllAmerican = false;
137 | wonAllConference = false;
138 | statsWins = 0;
139 |
140 | careerGamesPlayed = 0;
141 | careerHeismans = 0;
142 | careerAllAmerican = 0;
143 | careerAllConference = 0;
144 | careerWins = 0;
145 | }
146 |
147 | public Vector getRatingsVector() {
148 | ratingsVector = new Vector();
149 | ratingsVector.addElement(name+" ("+getYrStr()+")");
150 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
151 | ratingsVector.addElement(ratPot);
152 | ratingsVector.addElement(ratFootIQ);
153 | ratingsVector.addElement(ratOLPow);
154 | ratingsVector.addElement(ratOLBkR);
155 | ratingsVector.addElement(ratOLBkP);
156 | return ratingsVector;
157 | }
158 |
159 | @Override
160 | public void advanceSeason() {
161 | year++;
162 | int oldOvr = ratOvr;
163 | ratFootIQ += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
164 | ratOLPow += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
165 | ratOLBkR += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
166 | ratOLBkP += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
167 | if ( Math.random()*100 < ratPot ) {
168 | //breakthrough
169 | ratOLPow += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
170 | ratOLBkR += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
171 | ratOLBkP += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
172 | }
173 | ratOvr = (ratOLPow*3 + ratOLBkR + ratOLBkP)/5;
174 | ratImprovement = ratOvr - oldOvr;
175 |
176 | careerGamesPlayed += gamesPlayed;
177 | careerWins += statsWins;
178 |
179 | if (wonHeisman) careerHeismans++;
180 | if (wonAllAmerican) careerAllAmerican++;
181 | if (wonAllConference) careerAllConference++;
182 | }
183 |
184 | @Override
185 | public ArrayList getDetailStatsList(int games) {
186 | ArrayList pStats = new ArrayList<>();
187 | pStats.add("Games: " + gamesPlayed + " (" + statsWins + "-" + (gamesPlayed-statsWins) + ")" + ">Durability: " + getLetterGrade(ratDur));
188 | pStats.add("Football IQ: " + getLetterGrade(ratFootIQ) + ">Strength: " + getLetterGrade(ratOLPow));
189 | pStats.add("Run Block: " + getLetterGrade(ratOLBkR) + ">Pass Block: " + getLetterGrade(ratOLBkP));
190 | pStats.add(" > ");
191 | return pStats;
192 | }
193 |
194 | @Override
195 | public ArrayList getDetailAllStatsList(int games) {
196 | ArrayList pStats = new ArrayList<>();
197 | pStats.add("Games: " + gamesPlayed + " (" + statsWins + "-" + (gamesPlayed-statsWins) + ")" + ">Durability: " + getLetterGrade(ratDur));
198 | pStats.add("Football IQ: " + getLetterGrade(ratFootIQ) + ">Strength: " + getLetterGrade(ratOLPow));
199 | pStats.add("Run Block: " + getLetterGrade(ratOLBkR) + ">Pass Block: " + getLetterGrade(ratOLBkP));
200 | pStats.add("[B]CAREER STATS:");
201 | pStats.addAll(getCareerStatsList());
202 | return pStats;
203 | }
204 |
205 | @Override
206 | public String getInfoForLineup() {
207 | if (injury != null) return getInitialName() + " [" + getYrStr() + "] " + ratOvr + "/" + getLetterGrade(ratPot) + " " + injury.toString();
208 | return getInitialName() + " [" + getYrStr() + "] " + ratOvr + "/" + getLetterGrade(ratPot) + " (" +
209 | getLetterGrade(ratOLPow) + ", " + getLetterGrade(ratOLBkR) + ", " + getLetterGrade(ratOLBkP) + ")";
210 | }
211 | }
212 |
--------------------------------------------------------------------------------
/app/src/main/java/CFBsimPack/PlayerCB.java:
--------------------------------------------------------------------------------
1 | package CFBsimPack;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Vector;
5 |
6 | /**
7 | * Class for the CB player. 3 on the field each covering a WR.
8 | * @author Achi
9 | */
10 | public class PlayerCB extends Player {
11 |
12 | //public String name;
13 | //Overall rating, combination of other ratings
14 | //public int ratOvr;
15 | //Potential, affects how much he gets better in offseason
16 | //public int ratPot;
17 | //FootIQ, affects how smart he plays
18 | //public int ratFootIQ;
19 | //CBCov affects how good he is at covering the pass
20 | public int ratCBCov;
21 | //CBSpd affects how good he is at not letting up deep passes
22 | public int ratCBSpd;
23 | //CBTkl affects how good he is at tackling
24 | public int ratCBTkl;
25 |
26 | //public Vector ratingsVector;
27 |
28 | public PlayerCB( String nm, Team t, int yr, int pot, int iq, int cov, int spd, int tkl, boolean rs, int dur ) {
29 | team = t;
30 | name = nm;
31 | year = yr;
32 | gamesPlayed = 0;
33 | isInjured = false;
34 | ratOvr = (cov*2 + spd + tkl)/4;
35 | ratPot = pot;
36 | ratFootIQ = iq;
37 | ratDur = dur;
38 | ratCBCov = cov;
39 | ratCBSpd = spd;
40 | ratCBTkl = tkl;
41 | isRedshirt = rs;
42 | if (isRedshirt) year = 0;
43 | position = "CB";
44 |
45 | cost = (int)(Math.pow((float)ratOvr - 55,2)/4.5) + 50 + (int)(Math.random()*100) - 50;
46 |
47 | ratingsVector = new Vector();
48 | ratingsVector.addElement(name+" ("+getYrStr()+")");
49 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
50 | ratingsVector.addElement(ratPot);
51 | ratingsVector.addElement(ratFootIQ);
52 | ratingsVector.addElement(ratCBCov);
53 | ratingsVector.addElement(ratCBSpd);
54 | ratingsVector.addElement(ratCBTkl);
55 |
56 | wonHeisman = false;
57 | wonAllAmerican = false;
58 | wonAllConference = false;
59 | statsWins = 0;
60 |
61 | careerGamesPlayed = 0;
62 | careerHeismans = 0;
63 | careerAllAmerican = 0;
64 | careerAllConference = 0;
65 | careerWins = 0;
66 | }
67 |
68 | public PlayerCB( String nm, Team t, int yr, int pot, int iq, int cov, int spd, int tkl, boolean rs, int dur,
69 | int cGamesPlayed, int cHeismans, int cAA, int cAC, int cWins ) {
70 | team = t;
71 | name = nm;
72 | year = yr;
73 | gamesPlayed = 0;
74 | isInjured = false;
75 | ratOvr = (cov*2 + spd + tkl)/4;
76 | ratPot = pot;
77 | ratFootIQ = iq;
78 | ratDur = dur;
79 | ratCBCov = cov;
80 | ratCBSpd = spd;
81 | ratCBTkl = tkl;
82 | isRedshirt = rs;
83 | if (isRedshirt) year = 0;
84 | position = "CB";
85 |
86 | cost = (int)(Math.pow((float)ratOvr - 55,2)/4.5) + 50 + (int)(Math.random()*100) - 50;
87 |
88 | ratingsVector = new Vector();
89 | ratingsVector.addElement(name+" ("+getYrStr()+")");
90 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
91 | ratingsVector.addElement(ratPot);
92 | ratingsVector.addElement(ratFootIQ);
93 | ratingsVector.addElement(ratCBCov);
94 | ratingsVector.addElement(ratCBSpd);
95 | ratingsVector.addElement(ratCBTkl);
96 |
97 | wonHeisman = false;
98 | wonAllAmerican = false;
99 | wonAllConference = false;
100 | statsWins = 0;
101 |
102 | careerGamesPlayed = cGamesPlayed;
103 | careerHeismans = cHeismans;
104 | careerAllAmerican = cAA;
105 | careerAllConference = cAC;
106 | careerWins = cWins;
107 | }
108 |
109 | public PlayerCB( String nm, int yr, int stars, Team t ) {
110 | name = nm;
111 | year = yr;
112 | team = t;
113 | gamesPlayed = 0;
114 | isInjured = false;
115 | ratPot = (int) (50 + 50*Math.random());
116 | ratFootIQ = (int) (50 + 50*Math.random());
117 | ratDur = (int) (50 + 50*Math.random());
118 | ratCBCov = (int) (60 + year*5 + stars*5 - 25*Math.random());
119 | ratCBSpd = (int) (60 + year*5 + stars*5 - 25*Math.random());
120 | ratCBTkl = (int) (60 + year*5 + stars*5 - 25*Math.random());
121 | ratOvr = (ratCBCov*2 + ratCBSpd + ratCBTkl)/4;
122 | position = "CB";
123 |
124 | cost = (int)(Math.pow((float)ratOvr - 55,2)/4.5) + 50 + (int)(Math.random()*100) - 50;
125 |
126 | ratingsVector = new Vector();
127 | ratingsVector.addElement(name+" ("+getYrStr()+")");
128 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
129 | ratingsVector.addElement(ratPot);
130 | ratingsVector.addElement(ratFootIQ);
131 | ratingsVector.addElement(ratCBCov);
132 | ratingsVector.addElement(ratCBSpd);
133 | ratingsVector.addElement(ratCBTkl);
134 |
135 | wonHeisman = false;
136 | wonAllAmerican = false;
137 | wonAllConference = false;
138 | statsWins = 0;
139 |
140 | careerGamesPlayed = 0;
141 | careerHeismans = 0;
142 | careerAllAmerican = 0;
143 | careerAllConference = 0;
144 | careerWins = 0;
145 | }
146 |
147 | public Vector getRatingsVector() {
148 | ratingsVector = new Vector();
149 | ratingsVector.addElement(name+" ["+getYrStr()+"]");
150 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
151 | ratingsVector.addElement(ratPot);
152 | ratingsVector.addElement(ratFootIQ);
153 | ratingsVector.addElement(ratCBCov);
154 | ratingsVector.addElement(ratCBSpd);
155 | ratingsVector.addElement(ratCBTkl);
156 | return ratingsVector;
157 | }
158 |
159 | @Override
160 | public void advanceSeason() {
161 | year++;
162 | int oldOvr = ratOvr;
163 | // old: ratPot - 25
164 | // new ratPot + gamesPlayed - 35
165 | ratFootIQ += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
166 | ratCBCov += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
167 | ratCBSpd += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
168 | ratCBTkl += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
169 | if ( Math.random()*100 < ratPot ) {
170 | //breakthrough
171 | ratCBCov += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
172 | ratCBSpd += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
173 | ratCBTkl += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
174 | }
175 | ratOvr = (ratCBCov*2 + ratCBSpd + ratCBTkl)/4;
176 | ratImprovement = ratOvr - oldOvr;
177 |
178 | careerGamesPlayed += gamesPlayed;
179 | careerWins += statsWins;
180 |
181 | if (wonHeisman) careerHeismans++;
182 | if (wonAllAmerican) careerAllAmerican++;
183 | if (wonAllConference) careerAllConference++;
184 | }
185 |
186 | @Override
187 | public ArrayList getDetailStatsList(int games) {
188 | ArrayList pStats = new ArrayList<>();
189 | pStats.add("Games: " + gamesPlayed + " (" + statsWins + "-" + (gamesPlayed-statsWins) + ")" + ">Durability: " + getLetterGrade(ratDur));
190 | pStats.add("Football IQ: " + getLetterGrade(ratFootIQ) + ">Coverage: " + getLetterGrade(ratCBCov));
191 | pStats.add("Speed: " + getLetterGrade(ratCBSpd) + ">Tackling: " + getLetterGrade(ratCBTkl));
192 | pStats.add(" > ");
193 | return pStats;
194 | }
195 |
196 | @Override
197 | public ArrayList getDetailAllStatsList(int games) {
198 | ArrayList pStats = new ArrayList<>();
199 | pStats.add("Games: " + gamesPlayed + " (" + statsWins + "-" + (gamesPlayed-statsWins) + ")" + ">Durability: " + getLetterGrade(ratDur));
200 | pStats.add("Football IQ: " + getLetterGrade(ratFootIQ) + ">Coverage: " + getLetterGrade(ratCBCov));
201 | pStats.add("Speed: " + getLetterGrade(ratCBSpd) + ">Tackling: " + getLetterGrade(ratCBTkl));
202 | pStats.add("[B]CAREER STATS:");
203 | pStats.addAll(getCareerStatsList());
204 | return pStats;
205 | }
206 |
207 | @Override
208 | public String getInfoForLineup() {
209 | if (injury != null) return getInitialName() + " [" + getYrStr() + "] " + ratOvr + "/" + getLetterGrade(ratPot) + " " + injury.toString();
210 | return getInitialName() + " [" + getYrStr() + "] " + ratOvr + "/" + getLetterGrade(ratPot) + " (" +
211 | getLetterGrade(ratCBCov) + ", " + getLetterGrade(ratCBSpd) + ", " + getLetterGrade(ratCBTkl) + ")";
212 | }
213 |
214 | }
215 |
--------------------------------------------------------------------------------
/app/src/main/java/CFBsimPack/PlayerS.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package CFBsimPack;
7 |
8 | import java.util.ArrayList;
9 | import java.util.Vector;
10 |
11 | /**
12 | * Class for the safety player. One on field.
13 | * @author Achi
14 | */
15 | public class PlayerS extends Player {
16 |
17 | //public String name;
18 | //Overall rating, combination of other ratings
19 | //public int ratOvr;
20 | //Potential, affects how much he gets better in offseason
21 | //public int ratPot;
22 | //FootIQ, affects how smart he plays and how involved he is in each play
23 | //public int ratFootIQ;
24 | //CBCov affects how good he is at covering the pass
25 | public int ratSCov;
26 | //CBSpd affects how good he is at not letting up deep passes
27 | public int ratSSpd;
28 | //CBTkl affects how good he is at tackling
29 | public int ratSTkl;
30 |
31 | //public Vector ratingsVector;
32 |
33 | public PlayerS( String nm, Team t, int yr, int pot, int iq, int cov, int spd, int tkl, boolean rs, int dur ) {
34 | team = t;
35 | name = nm;
36 | year = yr;
37 | gamesPlayed = 0;
38 | isInjured = false;
39 | ratOvr = (cov*2 + spd + tkl)/4;
40 | ratPot = pot;
41 | ratFootIQ = iq;
42 | ratDur = dur;
43 | ratSCov = cov;
44 | ratSSpd = spd;
45 | ratSTkl = tkl;
46 | isRedshirt = rs;
47 | if (isRedshirt) year = 0;
48 | position = "S";
49 |
50 | cost = (int)(Math.pow((float)ratOvr - 55,2)/3.5) + 125 + (int)(Math.random()*100) - 50;
51 |
52 | ratingsVector = new Vector();
53 | ratingsVector.addElement(name+" ("+getYrStr()+")");
54 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
55 | ratingsVector.addElement(ratPot);
56 | ratingsVector.addElement(ratFootIQ);
57 | ratingsVector.addElement(ratSCov);
58 | ratingsVector.addElement(ratSSpd);
59 | ratingsVector.addElement(ratSTkl);
60 |
61 | wonHeisman = false;
62 | wonAllAmerican = false;
63 | wonAllConference = false;
64 | statsWins = 0;
65 |
66 | careerGamesPlayed = 0;
67 | careerHeismans = 0;
68 | careerAllAmerican = 0;
69 | careerAllConference = 0;
70 | careerWins = 0;
71 | }
72 |
73 | public PlayerS( String nm, Team t, int yr, int pot, int iq, int cov, int spd, int tkl, boolean rs, int dur,
74 | int cGamesPlayed, int cHeismans, int cAA, int cAC, int cWins ) {
75 | team = t;
76 | name = nm;
77 | year = yr;
78 | gamesPlayed = 0;
79 | isInjured = false;
80 | ratOvr = (cov*2 + spd + tkl)/4;
81 | ratPot = pot;
82 | ratFootIQ = iq;
83 | ratDur = dur;
84 | ratSCov = cov;
85 | ratSSpd = spd;
86 | ratSTkl = tkl;
87 | isRedshirt = rs;
88 | if (isRedshirt) year = 0;
89 | position = "S";
90 |
91 | cost = (int)(Math.pow((float)ratOvr - 55,2)/3.5) + 125 + (int)(Math.random()*100) - 50;
92 |
93 | ratingsVector = new Vector();
94 | ratingsVector.addElement(name+" ("+getYrStr()+")");
95 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
96 | ratingsVector.addElement(ratPot);
97 | ratingsVector.addElement(ratFootIQ);
98 | ratingsVector.addElement(ratSCov);
99 | ratingsVector.addElement(ratSSpd);
100 | ratingsVector.addElement(ratSTkl);
101 |
102 | wonHeisman = false;
103 | wonAllAmerican = false;
104 | wonAllConference = false;
105 | statsWins = 0;
106 |
107 | careerGamesPlayed = cGamesPlayed;
108 | careerHeismans = cHeismans;
109 | careerAllAmerican = cAA;
110 | careerAllConference = cAC;
111 | careerWins = cWins;
112 | }
113 |
114 | public PlayerS( String nm, int yr, int stars, Team t ) {
115 | name = nm;
116 | year = yr;
117 | team = t;
118 | gamesPlayed = 0;
119 | isInjured = false;
120 | ratPot = (int) (50 + 50*Math.random());
121 | ratFootIQ = (int) (50 + 50*Math.random());
122 | ratDur = (int) (50 + 50*Math.random());
123 | ratSCov = (int) (60 + year*5 + stars*5 - 25*Math.random());
124 | ratSSpd = (int) (60 + year*5 + stars*5 - 25*Math.random());
125 | ratSTkl = (int) (60 + year*5 + stars*5 - 25*Math.random());
126 | ratOvr = (ratSCov*2 + ratSSpd + ratSTkl)/4;
127 | position = "S";
128 |
129 | cost = (int)(Math.pow((float)ratOvr - 55,2)/3.5) + 125 + (int)(Math.random()*100) - 50;
130 |
131 | ratingsVector = new Vector();
132 | ratingsVector.addElement(name+" ("+getYrStr()+")");
133 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
134 | ratingsVector.addElement(ratPot);
135 | ratingsVector.addElement(ratFootIQ);
136 | ratingsVector.addElement(ratSCov);
137 | ratingsVector.addElement(ratSSpd);
138 | ratingsVector.addElement(ratSTkl);
139 |
140 | wonHeisman = false;
141 | wonAllAmerican = false;
142 | wonAllConference = false;
143 | statsWins = 0;
144 |
145 | careerGamesPlayed = 0;
146 | careerHeismans = 0;
147 | careerAllAmerican = 0;
148 | careerAllConference = 0;
149 | careerWins = 0;
150 | }
151 |
152 | public Vector getRatingsVector() {
153 | ratingsVector = new Vector();
154 | ratingsVector.addElement(name+" ("+getYrStr()+")");
155 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
156 | ratingsVector.addElement(ratPot);
157 | ratingsVector.addElement(ratFootIQ);
158 | ratingsVector.addElement(ratSCov);
159 | ratingsVector.addElement(ratSSpd);
160 | ratingsVector.addElement(ratSTkl);
161 | return ratingsVector;
162 | }
163 |
164 | @Override
165 | public void advanceSeason() {
166 | year++;
167 | int oldOvr = ratOvr;
168 | ratFootIQ += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
169 | ratSCov += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
170 | ratSSpd += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
171 | ratSTkl += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
172 | if ( Math.random()*100 < ratPot ) {
173 | //breakthrough
174 | ratSCov += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
175 | ratSSpd += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
176 | ratSTkl += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
177 | }
178 | ratOvr = (ratSCov*2 + ratSSpd + ratSTkl)/4;
179 | ratImprovement = ratOvr - oldOvr;
180 |
181 | careerGamesPlayed += gamesPlayed;
182 | careerWins += statsWins;
183 |
184 | if (wonHeisman) careerHeismans++;
185 | if (wonAllAmerican) careerAllAmerican++;
186 | if (wonAllConference) careerAllConference++;
187 | }
188 |
189 | @Override
190 | public ArrayList getDetailStatsList(int games) {
191 | ArrayList pStats = new ArrayList<>();
192 | pStats.add("Games: " + gamesPlayed + " (" + statsWins + "-" + (gamesPlayed-statsWins) + ")" + ">Durability: " + getLetterGrade(ratDur));
193 | pStats.add("Football IQ: " + getLetterGrade(ratFootIQ) + ">Coverage: " + getLetterGrade(ratSCov));
194 | pStats.add("Speed: " + getLetterGrade(ratSSpd) + ">Tackling: " + getLetterGrade(ratSTkl));
195 | pStats.add(" > ");
196 | return pStats;
197 | }
198 |
199 | @Override
200 | public ArrayList getDetailAllStatsList(int games) {
201 | ArrayList pStats = new ArrayList<>();
202 | pStats.add("Games: " + gamesPlayed + " (" + statsWins + "-" + (gamesPlayed-statsWins) + ")" + ">Durability: " + getLetterGrade(ratDur));
203 | pStats.add("Football IQ: " + getLetterGrade(ratFootIQ) + ">Coverage: " + getLetterGrade(ratSCov));
204 | pStats.add("Speed: " + getLetterGrade(ratSSpd) + ">Tackling: " + getLetterGrade(ratSTkl));
205 | pStats.add("[B]CAREER STATS:");
206 | pStats.addAll(getCareerStatsList());
207 | return pStats;
208 | }
209 |
210 | @Override
211 | public String getInfoForLineup() {
212 | if (injury != null) return getInitialName() + " [" + getYrStr() + "] " + ratOvr + "/" + getLetterGrade(ratPot) + " " + injury.toString();
213 | return getInitialName() + " [" + getYrStr() + "] " + ratOvr + "/" + getLetterGrade(ratPot) + " (" +
214 | getLetterGrade(ratSCov) + ", " + getLetterGrade(ratSSpd) + ", " + getLetterGrade(ratSTkl) + ")";
215 | }
216 |
217 | }
218 |
--------------------------------------------------------------------------------
/app/src/main/java/CFBsimPack/PlayerF7.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package CFBsimPack;
7 |
8 | import java.util.ArrayList;
9 | import java.util.Vector;
10 |
11 | /**
12 | * Class for the "Front Seven" of defenses. 7 on field.
13 | * @author Achi
14 | */
15 | public class PlayerF7 extends Player {
16 |
17 | //public String name;
18 | //Overall rating, combination of other ratings
19 | //public int ratOvr;
20 | //Potential, affects how much he gets better in offseason
21 | //public int ratPot;
22 | //FootIQ, affects how smart he plays
23 | //public int ratFootIQ;
24 | //OLPow affects how strong he is against OL
25 | public int ratF7Pow;
26 | //OLBkR affects how well he defends running plays
27 | public int ratF7Rsh;
28 | //OLBkP affects how well he defends passing plays
29 | public int ratF7Pas;
30 |
31 | //public Vector ratingsVector;
32 |
33 | public PlayerF7( String nm, Team t, int yr, int pot, int iq, int pow, int rsh, int pas, boolean rs, int dur ) {
34 | team = t;
35 | name = nm;
36 | year = yr;
37 | gamesPlayed = 0;
38 | isInjured = false;
39 | ratOvr = (pow*3 + rsh + pas)/5;
40 | ratPot = pot;
41 | ratFootIQ = iq;
42 | ratDur = dur;
43 | ratF7Pow = pow;
44 | ratF7Rsh = rsh;
45 | ratF7Pas = pas;
46 | isRedshirt = rs;
47 | if (isRedshirt) year = 0;
48 | position = "F7";
49 |
50 | cost = (int)(Math.pow((float)ratOvr - 55,2)/6) + 50 + (int)(Math.random()*100) - 50;
51 |
52 | ratingsVector = new Vector();
53 | ratingsVector.addElement(name+" ("+getYrStr()+")");
54 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
55 | ratingsVector.addElement(ratPot);
56 | ratingsVector.addElement(ratFootIQ);
57 | ratingsVector.addElement(ratF7Pow);
58 | ratingsVector.addElement(ratF7Rsh);
59 | ratingsVector.addElement(ratF7Pas);
60 |
61 | wonHeisman = false;
62 | wonAllAmerican = false;
63 | wonAllConference = false;
64 | statsWins = 0;
65 |
66 | careerGamesPlayed = 0;
67 | careerHeismans = 0;
68 | careerAllAmerican = 0;
69 | careerAllConference = 0;
70 | careerWins = 0;
71 |
72 | }
73 |
74 | public PlayerF7( String nm, Team t, int yr, int pot, int iq, int pow, int rsh, int pas, boolean rs, int dur,
75 | int cGamesPlayed, int cHeismans, int cAA, int cAC, int cWins ) {
76 | team = t;
77 | name = nm;
78 | year = yr;
79 | gamesPlayed = 0;
80 | isInjured = false;
81 | ratOvr = (pow*3 + rsh + pas)/5;
82 | ratPot = pot;
83 | ratFootIQ = iq;
84 | ratDur = dur;
85 | ratF7Pow = pow;
86 | ratF7Rsh = rsh;
87 | ratF7Pas = pas;
88 | isRedshirt = rs;
89 | if (isRedshirt) year = 0;
90 | position = "F7";
91 |
92 | cost = (int)(Math.pow((float)ratOvr - 55,2)/6) + 50 + (int)(Math.random()*100) - 50;
93 |
94 | ratingsVector = new Vector();
95 | ratingsVector.addElement(name+" ("+getYrStr()+")");
96 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
97 | ratingsVector.addElement(ratPot);
98 | ratingsVector.addElement(ratFootIQ);
99 | ratingsVector.addElement(ratF7Pow);
100 | ratingsVector.addElement(ratF7Rsh);
101 | ratingsVector.addElement(ratF7Pas);
102 |
103 | wonHeisman = false;
104 | wonAllAmerican = false;
105 | wonAllConference = false;
106 | statsWins = 0;
107 |
108 | careerGamesPlayed = cGamesPlayed;
109 | careerHeismans = cHeismans;
110 | careerAllAmerican = cAA;
111 | careerAllConference = cAC;
112 | careerWins = cWins;
113 |
114 | }
115 |
116 | public PlayerF7( String nm, int yr, int stars, Team t ) {
117 | name = nm;
118 | year = yr;
119 | team = t;
120 | gamesPlayed = 0;
121 | isInjured = false;
122 | ratPot = (int) (50 + 50*Math.random());
123 | ratFootIQ = (int) (50 + 50*Math.random());
124 | ratDur = (int) (50 + 50*Math.random());
125 | ratF7Pow = (int) (60 + year*5 + stars*5 - 25*Math.random());
126 | ratF7Rsh = (int) (60 + year*5 + stars*5 - 25*Math.random());
127 | ratF7Pas = (int) (60 + year*5 + stars*5 - 25*Math.random());
128 | ratOvr = (ratF7Pow*3 + ratF7Rsh + ratF7Pas)/5;
129 | position = "F7";
130 |
131 | cost = (int)(Math.pow((float)ratOvr - 55,2)/6) + 50 + (int)(Math.random()*100) - 50;
132 |
133 | ratingsVector = new Vector();
134 | ratingsVector.addElement(name+" ("+getYrStr()+")");
135 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
136 | ratingsVector.addElement(ratPot);
137 | ratingsVector.addElement(ratFootIQ);
138 | ratingsVector.addElement(ratF7Pow);
139 | ratingsVector.addElement(ratF7Rsh);
140 | ratingsVector.addElement(ratF7Pas);
141 |
142 | wonHeisman = false;
143 | wonAllAmerican = false;
144 | wonAllConference = false;
145 | statsWins = 0;
146 |
147 | careerGamesPlayed = 0;
148 | careerHeismans = 0;
149 | careerAllAmerican = 0;
150 | careerAllConference = 0;
151 | careerWins = 0;
152 | }
153 |
154 | public Vector getRatingsVector() {
155 | ratingsVector = new Vector();
156 | ratingsVector.addElement(name+" ("+getYrStr()+")");
157 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
158 | ratingsVector.addElement(ratPot);
159 | ratingsVector.addElement(ratFootIQ);
160 | ratingsVector.addElement(ratF7Pow);
161 | ratingsVector.addElement(ratF7Rsh);
162 | ratingsVector.addElement(ratF7Pas);
163 | return ratingsVector;
164 | }
165 |
166 | @Override
167 | public void advanceSeason() {
168 | year++;
169 | int oldOvr = ratOvr;
170 | ratFootIQ += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
171 | ratF7Pow += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
172 | ratF7Rsh += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
173 | ratF7Pas += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
174 | if ( Math.random()*100 < ratPot ) {
175 | //breakthrough
176 | ratF7Pow += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
177 | ratF7Rsh += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
178 | ratF7Pas += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
179 | }
180 | ratOvr = (ratF7Pow*3 + ratF7Rsh + ratF7Pas)/5;
181 | ratImprovement = ratOvr - oldOvr;
182 |
183 | careerGamesPlayed += gamesPlayed;
184 | careerWins += statsWins;
185 |
186 | if (wonHeisman) careerHeismans++;
187 | if (wonAllAmerican) careerAllAmerican++;
188 | if (wonAllConference) careerAllConference++;
189 | }
190 |
191 | @Override
192 | public ArrayList getDetailStatsList(int games) {
193 | ArrayList pStats = new ArrayList<>();
194 | pStats.add("Games: " + gamesPlayed + " (" + statsWins + "-" + (gamesPlayed-statsWins) + ")" + ">Durability: " + getLetterGrade(ratDur));
195 | pStats.add("Football IQ: " + getLetterGrade(ratFootIQ) + ">Strength: " + getLetterGrade(ratF7Pow));
196 | pStats.add("Run Stop: " + getLetterGrade(ratF7Rsh) + ">Pass Pressure: " + getLetterGrade(ratF7Pas));
197 | pStats.add(" > ");
198 | return pStats;
199 | }
200 |
201 | @Override
202 | public ArrayList getDetailAllStatsList(int games) {
203 | ArrayList pStats = new ArrayList<>();
204 | pStats.add("Games: " + gamesPlayed + " (" + statsWins + "-" + (gamesPlayed-statsWins) + ")" + ">Durability: " + getLetterGrade(ratDur));
205 | pStats.add("Football IQ: " + getLetterGrade(ratFootIQ) + ">Strength: " + getLetterGrade(ratF7Pow));
206 | pStats.add("Run Stop: " + getLetterGrade(ratF7Rsh) + ">Pass Pressure: " + getLetterGrade(ratF7Pas));
207 | pStats.add("[B]CAREER STATS:");
208 | pStats.addAll(getCareerStatsList());
209 | return pStats;
210 | }
211 |
212 | @Override
213 | public String getInfoForLineup() {
214 | if (injury != null) return getInitialName() + " [" + getYrStr() + "] " + ratOvr + "/" + getLetterGrade(ratPot) + " " + injury.toString();
215 | return getInitialName() + " [" + getYrStr() + "] " + ratOvr + "/" + getLetterGrade(ratPot) + " (" +
216 | getLetterGrade(ratF7Pow) + ", " + getLetterGrade(ratF7Rsh) + ", " + getLetterGrade(ratF7Pas) + ")";
217 | }
218 |
219 | }
220 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #Football Coach
2 | 
3 |
4 | #**[Available now and for free on the Play Store!](https://play.google.com/store/apps/details?id=achijones.footballcoach)**
5 |
6 | To be clear, **Football Coach is a college football simulator/management game.** Though you yourself won't be controlling the QB via a joystick each play, you will be recruiting players, scouting other teams, setting strategies to help your team win, and simulating through the season week by week.
7 |
8 | ###[Here are some screenshots!](http://imgur.com/a/dj5JH)
9 |
10 |
11 | ###Basics:
12 | In Football Coach, you take the role of a newly hired coach at your college of choice. As coach, it will be your responsibility to manage your team's strategy, simulate through seasons, recruit new players, and above all, win championships.
13 |
14 | ###Playing a Season:
15 | Your team will play 12 games in the regular season, which consist of playing all 9 of your conference opponents once and three out-of-conference games. By navigating to the "GAMES" tab, you can see exactly what your team's schedule is. And by clicking on each game, you can see a scouting report of the two teams (if the game has yet to be played), or a summary of the game (if it was already played). The most important game of the regular season is your rivalry game, which you gain prestige if won or lose prestige if lost.
16 |
17 | At the end of the regular season, the Conference Championship is played between the two teams with the best in-conference record. If two teams have the same record, a head-to-head tiebreaker is used. If three or more teams have the same record, the one with the highest poll ranking is chosen. After the Conference Championships, Bowl Games are played. Only the top 16 teams get chosen for a bowl, with the most important being the National Semifinals between the #1 and #4 team, and the #2 and #3 team. The winner of these two games advance to the National Championship where an undisputed champion is crowned.
18 |
19 | After the season, your team will have gained or lost prestige based on their results versus their expectations, and you move onto recruiting.
20 |
21 | ###Rankings:
22 | As your team plays through the season, it will be evaluated by pollsters who determine how good (or bad) your team is compared to others. This "Poll Ranking" is determined by wins, margin of victory, strength of schedule, and more, and has a big impact on how your season will play out, as it determines who gets into a bowl game and the semifinals. Many statistics are kept track of during the season, such as Yards Per Game, Opposing Points Per Game, Pass Yards Per Game, Turnover Differential and more. You can view all these statistics, as well as your team's ranking in each one, by navigating to the "STATS" tab.
23 |
24 | ###Roster:
25 | When you first inherit a team, you will have a total of 46 players (22 starters) on your roster. Each player has a name, their year in school (from Freshman to Senior), an Overall rating, Potential rating, and three position specific ratings. The Overall rating is just a composite rating of the three position specific ones, while Potential determines how much each play improves during the offseason. You can view all of these players in the "ROSTER" tab.
26 |
27 | QB (1 starter):
28 | - Quarterback, responsible for throwing passes to Wide Receivers
29 | - Pass Strength: how far the QB can throw. Higher strength means catches go for more yards.
30 | - Accuracy: how accurate the QB is. Higher accuracy means a greater chance that the throw will be caught, as well as a lower interception chance.
31 | - Evasion: how evasive the QB is. Higher evasion means less sacks.
32 |
33 | RB (2 starters):
34 | - Running Back, responsible for carrying the ball up and down the field.
35 | - Rush Power: how strong the RB is. Higher power means he is less likely to be stopped at the line of scrimmage.
36 | - Rush Speed: how quick the RB is. Higher speed means runs go for more yards.
37 | - Evasion: how agile the RB is. Higher evasion means a higher chance of breaking free for bigger runs.
38 |
39 | WR (3 starters):
40 | - Wide Receiver, responsible for catching passes from the QB downfield.
41 | - Catching: how good the WR is at catching the ball. Higher catching means higher chance of completion and less drops.
42 | - Speed: how quick the WR is. Higher speed means his catches go for more yards.
43 | - Evasion: how agile and crafty the WR is. Higher evasion means higher chance to break free for big gains and long touchdowns.
44 |
45 | OL (5 starters):
46 | - Offensive Line, responsible for protecting the QB and blocking for the RBs when they run.
47 | - Strength: most important rating, how strong the OL is.
48 | - Run Block: how good the OL is at blocking for rushing plays.
49 | - Pass Block: how good the OL is at blocking for pass plays.
50 |
51 | K (1 starter):
52 | - Kicker, responsible for kicking extra points and field goals.
53 | - Kick Strength: how strong the kicker's leg is. Higher strength means longer field goals.
54 | - Kick Accuracy: how accurate the kicker is, higher means kicks are more likely to be good.
55 | - Clumsiness: how clumsy the kicker is, higher means more chance of success at onside kicks.
56 |
57 | S (1 starter):
58 | - Safety, responsible for covering the pass and causing inteceptions from opposing QBs.
59 | - Coverage: how good the safety is at convering the pass and how good he is at catching interceptions.
60 | - Speed: how quick the safety is, affects how he can keep up with WRs.
61 | - Tackling: how good the safety is at tackling, higher means he is more likely to tackle WRs before they get away.
62 |
63 | CB (3 starters):
64 | - Cornerback, responsible for covering a corresponding WR.
65 | - Coverage: how good the cornerback is at covering receivers. Higher means less likely that the WR will complete the catch.
66 | - Speed: how quick the CB is, affects how he can keep up with WRs.
67 | - Tackling: how good the CB is at tackling, higher means he is more likely to tackle WRs before they get away.
68 |
69 | F7 (7 starters):
70 | - Front Seven, responsible for putting pressure on the opposing QB and tackling RBs.
71 | - Strength: most important rating, how strong the F7 is against opposing OLs.
72 | - Run Stop: how good the F7 is at tackling opposing RBs without allowing many yards.
73 | - Pass Pressure: how much pressure they put on the opposing QB, higher pressure means the QB will have a harder time throwing accurate passes.
74 |
75 | ###Team Strategy:
76 |
77 | As a coach, you can pick what strategy your team employs on offense and defense as they play through their season. By default both strategies are set to "No Preference", meaning there are no bonuses or penalties either way. But you can change your strategy to any of the following:
78 |
79 | [Offense] Aggressive:
80 | - Utilize a more aggressive offense. Will pass a bit more.
81 | - Pass with a lower completion percentage and higher chance of interception.
82 | - However, passes that are caught will go for more yards.
83 | -
84 | [Offense] Conservative:
85 | - Utilize a more conservative offense. Will run a bit more.
86 | - Passes are more accurate but go for less yards.
87 | - Rushes are more likely to gain yards but less likely to break free for big plays.
88 |
89 | [Defense] Stack the Box:
90 | - Defensive scheme with emphasis on stopping the run.
91 | - Will give up more big passing plays but will allow less rushing yards and big plays from rushing.
92 |
93 | [Defense] No Fly Zone:
94 | - Defensive scheme with emphasis on limiting the pass.
95 | - Will give up less yards on catches and be more likely to intercept passes.
96 | - However, rushing plays will go for more yards.
97 |
98 | ###Recruiting:
99 |
100 | At the end of each season, graduating seniors leave the program and spots open up. As coach, you are responsible for recruiting the next class of players that will lead your team to bigger and better wins. You recruit based on a budget, which is determined by your team's prestige. Better teams will have more money to work with, while worse teams will have to save money wherever they can.
101 |
102 | When you press "Begin Recruiting" after the season, you can see who is leaving your program and give you a sense of how many players you will need to replace. Next, the Recruiting menu opens up. You can view recruits from every position or select "Top 100 Recruits" to see the best of the best. Each Recruit has their positional ratings as well as an Overall and Potential. The cost of each recruit (insert Cam Newton joke here) is determined by how good they are. Once you are done recruiting all the players you need, or have money for, you can press "Done" to advance to the next season.
103 |
104 | ###Saving:
105 |
106 | In Football Coach, you can save your game at any time during the season. HOWEVER, since so much data is generated during the course of the season, Save Games are only saved FROM THE BEGINNING OF THE SEASON. For example, if you play through 5 games of the 2017 season, save your game, and then load it back up later, your game will start back at the beginning of the 2017 season.
107 |
108 | ###Donations:
109 | Football Coach is not monetized and I have no plans to do so. I love college football and seeing people use my app is all the encouragement I need. But if you love the app and you would like to let me know, you can donate via PayPal:
110 |
111 | [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GAJZ8MFAY73D6)
112 |
113 |
114 | **[Download Football Coach from the Google Play Store](https://play.google.com/store/apps/details?id=achijones.footballcoach)**
115 |
116 |
117 |
--------------------------------------------------------------------------------
/app/src/main/java/achijones/footballcoach/Home.java:
--------------------------------------------------------------------------------
1 | package achijones.footballcoach;
2 |
3 | import android.app.AlertDialog;
4 | import android.content.DialogInterface;
5 | import android.content.Intent;
6 | import android.net.Uri;
7 | import android.os.Bundle;
8 | import android.support.v7.app.AppCompatActivity;
9 | import android.support.v7.widget.Toolbar;
10 | import android.util.TypedValue;
11 | import android.view.View;
12 | import android.view.Menu;
13 | import android.view.MenuItem;
14 | import android.widget.Button;
15 | import android.widget.ImageView;
16 | import android.widget.TextView;
17 | import android.widget.Toast;
18 |
19 | import achijones.footballcoach.R;
20 |
21 | import java.io.BufferedReader;
22 | import java.io.File;
23 | import java.io.FileNotFoundException;
24 | import java.io.FileReader;
25 | import java.io.IOException;
26 | import java.util.ArrayList;
27 |
28 | public class Home extends AppCompatActivity {
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setContentView(R.layout.activity_home);
34 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
35 | setSupportActionBar(toolbar);
36 |
37 | ImageView imageLogo = (ImageView) findViewById(R.id.imageLogo);
38 | imageLogo.setImageResource(R.drawable.main_menu_logo);
39 |
40 | Button newGameButton = (Button) findViewById(R.id.buttonNewGame);
41 | newGameButton.setOnClickListener(new View.OnClickListener() {
42 | public void onClick(View v) {
43 | // Perform action on click
44 | AlertDialog.Builder builder = new AlertDialog.Builder(Home.this);
45 | builder.setMessage("What difficulty would you like?\n\n" +
46 | "Easy Mode has no injuries, normal rivalry mechanics, and a 50% chance your good players will leave early for the NFL.\n\n" +
47 | "Hard Mode has injuries enabled, harder rivalry games, and a 70% chance your good players will leave early for the NFL.\n\n" +
48 | "This cannot be changed later.")
49 | .setTitle("Choose Difficulty:")
50 | .setPositiveButton("EASY", new DialogInterface.OnClickListener() {
51 | @Override
52 | public void onClick(DialogInterface dialog, int which) {
53 | //do nothing?
54 | Intent myIntent = new Intent(Home.this, MainActivity.class);
55 | myIntent.putExtra("SAVE_FILE", "NEW_LEAGUE_EASY");
56 | Home.this.startActivity(myIntent);
57 | }
58 | })
59 | .setNegativeButton("HARD", new DialogInterface.OnClickListener() {
60 | @Override
61 | public void onClick(DialogInterface dialog, int which) {
62 | //do nothing?
63 | Intent myIntent = new Intent(Home.this, MainActivity.class);
64 | myIntent.putExtra("SAVE_FILE", "NEW_LEAGUE_HARD");
65 | Home.this.startActivity(myIntent);
66 | }
67 | });
68 | AlertDialog dialog = builder.create();
69 | dialog.show();
70 | TextView msgTxt = (TextView) dialog.findViewById(android.R.id.message);
71 | msgTxt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
72 |
73 | }
74 | });
75 |
76 | Button loadGameButton = (Button) findViewById(R.id.buttonLoadGame);
77 | loadGameButton.setOnClickListener(new View.OnClickListener() {
78 | public void onClick(View v) {
79 | // Perform action on click
80 | loadLeague();
81 | }
82 | });
83 |
84 | Button tutorialButton = (Button) findViewById(R.id.buttonTutorial);
85 | tutorialButton.setOnClickListener(new View.OnClickListener() {
86 | public void onClick(View v) {
87 | // Perform action on click
88 | Intent myIntent = new Intent(Home.this, TutorialActivity.class);
89 | Home.this.startActivity(myIntent);
90 | }
91 | });
92 |
93 | Button subredditButton = (Button) findViewById(R.id.buttonSubreddit);
94 | subredditButton.setOnClickListener(new View.OnClickListener() {
95 | public void onClick(View v) {
96 | Intent intent = new Intent();
97 | intent.setAction(Intent.ACTION_VIEW);
98 | intent.addCategory(Intent.CATEGORY_BROWSABLE);
99 | intent.setData(Uri.parse("http://m.reddit.com/r/FootballCoach"));
100 | startActivity(intent);
101 | }
102 | });
103 |
104 | Button hoopsButton = (Button) findViewById(R.id.buttonHoopsCoach);
105 | hoopsButton.setOnClickListener(new View.OnClickListener() {
106 | public void onClick(View v) {
107 | try {
108 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=io.coachapps.collegebasketballcoach")));
109 | } catch (android.content.ActivityNotFoundException anfe) {
110 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=io.coachapps.collegebasketballcoach")));
111 | }
112 | }
113 | });
114 |
115 | Button proButton = (Button) findViewById(R.id.buttonProFootballCoach);
116 | proButton.setOnClickListener(new View.OnClickListener() {
117 | public void onClick(View v) {
118 | try {
119 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.achijones.profootballcoach")));
120 | } catch (android.content.ActivityNotFoundException anfe) {
121 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=com.achijones.profootballcoach")));
122 | }
123 | }
124 | });
125 |
126 |
127 |
128 | }
129 |
130 | @Override
131 | public boolean onCreateOptionsMenu(Menu menu) {
132 | // Inflate the menu; this adds items to the action bar if it is present.
133 | getMenuInflater().inflate(R.menu.menu_home, menu);
134 | return true;
135 | }
136 |
137 | @Override
138 | public boolean onOptionsItemSelected(MenuItem item) {
139 | // Handle action bar item clicks here. The action bar will
140 | // automatically handle clicks on the Home/Up button, so long
141 | // as you specify a parent activity in AndroidManifest.xml.
142 | int id = item.getItemId();
143 |
144 | return super.onOptionsItemSelected(item);
145 | }
146 |
147 | /**
148 | * Save League, show dialog to choose which save file to save onto.
149 | */
150 | private void loadLeague() {
151 | AlertDialog.Builder builder = new AlertDialog.Builder(this);
152 | builder.setTitle("Choose File to Load:");
153 | final String[] fileInfos = getSaveFileInfos();
154 | SaveFilesListArrayAdapter saveFilesAdapter = new SaveFilesListArrayAdapter(this, fileInfos);
155 | builder.setAdapter(saveFilesAdapter, new DialogInterface.OnClickListener() {
156 | public void onClick(DialogInterface dialog, int item) {
157 | // Do something with the selection
158 | if (!fileInfos[item].equals("EMPTY")) {
159 | Intent myIntent = new Intent(Home.this, MainActivity.class);
160 | myIntent.putExtra("SAVE_FILE", "saveFile" + item + ".cfb");
161 | Home.this.startActivity(myIntent);
162 | } else {
163 | Toast.makeText(Home.this, "Cannot load empty file!",
164 | Toast.LENGTH_SHORT).show();
165 | }
166 | }
167 | });
168 | builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
169 | @Override
170 | public void onClick(DialogInterface dialog, int which) {
171 | // Do nothing
172 | }
173 | });
174 | AlertDialog alert = builder.create();
175 | alert.show();
176 | }
177 |
178 | /**
179 | * Get info of the 10 save files for printing in the save file list
180 | */
181 | private String[] getSaveFileInfos() {
182 | String[] infos = new String[10];
183 | String fileInfo;
184 | File saveFile;
185 | for (int i = 0; i < 10; ++i) {
186 | saveFile = new File(getFilesDir(), "saveFile" + i + ".cfb");
187 | if (saveFile.exists()) {
188 | try {
189 | BufferedReader bufferedReader = new BufferedReader( new FileReader(saveFile) );
190 | fileInfo = bufferedReader.readLine();
191 | infos[i] = fileInfo.substring(0, fileInfo.length()-1); //gets rid of % at end
192 | } catch(FileNotFoundException ex) {
193 | System.out.println(
194 | "Unable to open file");
195 | } catch(IOException ex) {
196 | System.out.println(
197 | "Error reading file");
198 | } catch (NullPointerException ex) {
199 | System.out.println(
200 | "Null pointer exception!");
201 | }
202 | } else {
203 | infos[i] = "EMPTY";
204 | }
205 | }
206 | return infos;
207 | }
208 | }
209 |
--------------------------------------------------------------------------------
/app/src/main/java/CFBsimPack/PlayerRB.java:
--------------------------------------------------------------------------------
1 | package CFBsimPack;
2 |
3 | import java.util.ArrayList;
4 | import java.util.Vector;
5 |
6 | /**
7 | * Class for the RB player.
8 | * @author Achi
9 | */
10 | public class PlayerRB extends Player {
11 |
12 | //public String name;
13 | //Overall rating, combination of other ratings
14 | //public int ratOvr;
15 | //Potential, affects how much he gets better in offseason
16 | //public int ratPot;
17 | //FootIQ, affects how smart he plays
18 | //public int ratFootIQ;
19 | //RushPow affects how consistenly he can get past line of scrimmage
20 | public int ratRushPow;
21 | //RushSpd affects how long he can run
22 | public int ratRushSpd;
23 | //RushEva affects how easily he can dodge tackles
24 | public int ratRushEva;
25 |
26 | //public Vector ratingsVector;
27 |
28 | //Stats
29 | public int statsRushAtt;
30 | public int statsRushYards;
31 | public int statsTD;
32 | public int statsFumbles;
33 |
34 | public int careerRushAtt;
35 | public int careerRushYards;
36 | public int careerTDs;
37 | public int careerFumbles;
38 |
39 |
40 | public PlayerRB( String nm, Team t, int yr, int pot, int iq, int pow, int spd, int eva, boolean rs, int dur ) {
41 | team = t;
42 | name = nm;
43 | year = yr;
44 | gamesPlayed = 0;
45 | isInjured = false;
46 | ratOvr = (pow + spd + eva)/3;
47 | ratPot = pot;
48 | ratFootIQ = iq;
49 | ratDur = dur;
50 | ratRushPow = pow;
51 | ratRushSpd = spd;
52 | ratRushEva = eva;
53 | isRedshirt = rs;
54 | if (isRedshirt) year = 0;
55 |
56 | cost = (int)(Math.pow((float)ratOvr - 55,2)/2) + 70 + (int)(Math.random()*100) - 50;
57 |
58 | ratingsVector = new Vector();
59 | ratingsVector.addElement(name+" ("+getYrStr()+")");
60 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
61 | ratingsVector.addElement(ratPot);
62 | ratingsVector.addElement(ratFootIQ);
63 | ratingsVector.addElement(ratRushPow);
64 | ratingsVector.addElement(ratRushSpd);
65 | ratingsVector.addElement(ratRushEva);
66 |
67 | statsRushAtt = 0;
68 | statsRushYards = 0;
69 | statsTD = 0;
70 | statsFumbles = 0;
71 | wonHeisman = false;
72 | wonAllAmerican = false;
73 | wonAllConference = false;
74 | statsWins = 0;
75 |
76 | careerRushAtt = 0;
77 | careerRushYards = 0;
78 | careerTDs = 0;
79 | careerFumbles = 0;
80 | careerGamesPlayed = 0;
81 | careerHeismans = 0;
82 | careerAllAmerican = 0;
83 | careerAllConference = 0;
84 | careerWins = 0;
85 |
86 | position = "RB";
87 | }
88 |
89 | public PlayerRB( String nm, Team t, int yr, int pot, int iq, int pow, int spd, int eva, boolean rs, int dur,
90 | int cGamesPlayed, int cRushAtt, int cRushYards, int cTDs, int cFumbles,
91 | int cHeismans, int cAA, int cAC, int cWins) {
92 | team = t;
93 | name = nm;
94 | year = yr;
95 | gamesPlayed = 0;
96 | isInjured = false;
97 | ratOvr = (pow + spd + eva)/3;
98 | ratPot = pot;
99 | ratFootIQ = iq;
100 | ratDur = dur;
101 | ratRushPow = pow;
102 | ratRushSpd = spd;
103 | ratRushEva = eva;
104 | isRedshirt = rs;
105 | if (isRedshirt) year = 0;
106 |
107 | cost = (int)(Math.pow((float)ratOvr - 55,2)/2) + 70 + (int)(Math.random()*100) - 50;
108 |
109 | ratingsVector = new Vector();
110 | ratingsVector.addElement(name+" ("+getYrStr()+")");
111 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
112 | ratingsVector.addElement(ratPot);
113 | ratingsVector.addElement(ratFootIQ);
114 | ratingsVector.addElement(ratRushPow);
115 | ratingsVector.addElement(ratRushSpd);
116 | ratingsVector.addElement(ratRushEva);
117 |
118 | statsRushAtt = 0;
119 | statsRushYards = 0;
120 | statsTD = 0;
121 | statsFumbles = 0;
122 | wonHeisman = false;
123 | wonAllAmerican = false;
124 | wonAllConference = false;
125 | statsWins = 0;
126 |
127 | careerRushAtt = cRushAtt;
128 | careerRushYards = cRushYards;
129 | careerTDs = cTDs;
130 | careerFumbles = cFumbles;
131 | careerGamesPlayed = cGamesPlayed;
132 | careerHeismans = cHeismans;
133 | careerAllAmerican = cAA;
134 | careerAllConference = cAC;
135 | careerWins = cWins;
136 |
137 | position = "RB";
138 | }
139 |
140 | public PlayerRB( String nm, int yr, int stars, Team t ) {
141 | name = nm;
142 | year = yr;
143 | team = t;
144 | gamesPlayed = 0;
145 | isInjured = false;
146 | ratPot = (int) (50 + 50*Math.random());
147 | ratFootIQ = (int) (50 + 50*Math.random());
148 | ratDur = (int) (50 + 50*Math.random());
149 | ratRushPow = (int) (60 + year*5 + stars*5 - 25*Math.random());
150 | ratRushSpd = (int) (60 + year*5 + stars*5 - 25*Math.random());
151 | ratRushEva = (int) (60 + year*5 + stars*5 - 25*Math.random());
152 | ratOvr = (ratRushPow + ratRushSpd + ratRushEva)/3;
153 |
154 | cost = (int)(Math.pow((float)ratOvr - 55,2)/2) + 70 + (int)(Math.random()*100) - 50;
155 |
156 | ratingsVector = new Vector();
157 | ratingsVector.addElement(name+" ("+getYrStr()+")");
158 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
159 | ratingsVector.addElement(ratPot);
160 | ratingsVector.addElement(ratFootIQ);
161 | ratingsVector.addElement(ratRushPow);
162 | ratingsVector.addElement(ratRushSpd);
163 | ratingsVector.addElement(ratRushEva);
164 |
165 | statsRushAtt = 0;
166 | statsRushYards = 0;
167 | statsTD = 0;
168 | statsFumbles = 0;
169 | wonHeisman = false;
170 | wonAllAmerican = false;
171 | wonAllConference = false;
172 | statsWins = 0;
173 |
174 | careerRushAtt = 0;
175 | careerRushYards = 0;
176 | careerTDs = 0;
177 | careerFumbles = 0;
178 | careerGamesPlayed = 0;
179 | careerHeismans = 0;
180 | careerAllAmerican = 0;
181 | careerAllConference = 0;
182 | careerWins = 0;
183 |
184 | position = "RB";
185 | }
186 |
187 | public Vector getStatsVector() {
188 | Vector v = new Vector(5);
189 | v.add(statsRushAtt);
190 | v.add(statsRushYards);
191 | v.add(statsTD);
192 | v.add(statsFumbles);
193 | v.add((float)((int)((float)statsRushYards/statsRushAtt*100))/100);
194 | return v;
195 | }
196 |
197 | public Vector getRatingsVector() {
198 | ratingsVector = new Vector();
199 | ratingsVector.addElement(name+" ("+getYrStr()+")");
200 | ratingsVector.addElement(ratOvr+" (+"+ratImprovement+")");
201 | ratingsVector.addElement(ratPot);
202 | ratingsVector.addElement(ratFootIQ);
203 | ratingsVector.addElement(ratRushPow);
204 | ratingsVector.addElement(ratRushSpd);
205 | ratingsVector.addElement(ratRushEva);
206 | return ratingsVector;
207 | }
208 |
209 | @Override
210 | public void advanceSeason() {
211 | year++;
212 | int oldOvr = ratOvr;
213 | ratFootIQ += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
214 | ratRushPow += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
215 | ratRushSpd += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
216 | ratRushEva += (int)(Math.random()*(ratPot + gamesPlayed - 35))/10;
217 | if ( Math.random()*100 < ratPot ) {
218 | //breakthrough
219 | ratRushPow += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
220 | ratRushSpd += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
221 | ratRushEva += (int)(Math.random()*(ratPot + gamesPlayed - 40))/10;
222 | }
223 | ratOvr = (ratRushPow + ratRushSpd + ratRushEva)/3;
224 | ratImprovement = ratOvr - oldOvr;
225 | //reset stats (keep career stats?)
226 | careerRushAtt += statsRushAtt;
227 | careerRushYards += statsRushYards;
228 | careerTDs += statsTD;
229 | careerFumbles += statsFumbles;
230 | careerGamesPlayed += gamesPlayed;
231 | careerWins += statsWins;
232 |
233 | if (wonHeisman) careerHeismans++;
234 | if (wonAllAmerican) careerAllAmerican++;
235 | if (wonAllConference) careerAllConference++;
236 |
237 | statsRushAtt = 0;
238 | statsRushYards = 0;
239 | statsTD = 0;
240 | statsFumbles = 0;
241 | }
242 |
243 | @Override
244 | public int getHeismanScore() {
245 | return statsTD * 100 - statsFumbles * 80 + (int)(statsRushYards * 2.35);
246 | }
247 |
248 | @Override
249 | public ArrayList getDetailStatsList(int games) {
250 | ArrayList pStats = new ArrayList<>();
251 | pStats.add("TDs: " + statsTD + ">Fumbles: " + statsFumbles);
252 | pStats.add("Rush Yards: " + statsRushYards + " yds>Yards/Att: " + ((double)(10*statsRushYards/(statsRushAtt+1))/10) + " yds");
253 | pStats.add("Yds/Game: " + (statsRushYards/getGamesPlayed()) + " yds/g>Rush Att: " + statsRushAtt);
254 | pStats.add("Games: " + gamesPlayed + " (" + statsWins + "-" + (gamesPlayed-statsWins) + ")" + ">Durability: " + getLetterGrade(ratDur));
255 | pStats.add("Football IQ: " + getLetterGrade(ratFootIQ) + ">Rush Power: " + getLetterGrade(ratRushPow));
256 | pStats.add("Rush Speed: " + getLetterGrade(ratRushSpd) + ">Evasion: " + getLetterGrade(ratRushEva));
257 | pStats.add(" > ");
258 | return pStats;
259 | }
260 |
261 | @Override
262 | public ArrayList getDetailAllStatsList(int games) {
263 | ArrayList pStats = new ArrayList<>();
264 | pStats.add("TDs: " + statsTD + ">Fumbles: " + statsFumbles);
265 | pStats.add("Rush Yards: " + statsRushYards + " yds>Yards/Att: " + ((double)(10*statsRushYards/(statsRushAtt+1))/10) + " yds");
266 | pStats.add("Yds/Game: " + (statsRushYards/getGamesPlayed()) + " yds/g>Rush Att: " + statsRushAtt);
267 | pStats.add("Games: " + gamesPlayed + " (" + statsWins + "-" + (gamesPlayed-statsWins) + ")" + ">Durability: " + getLetterGrade(ratDur));
268 | pStats.add("Football IQ: " + getLetterGrade(ratFootIQ) + ">Rush Power: " + getLetterGrade(ratRushPow));
269 | pStats.add("Rush Speed: " + getLetterGrade(ratRushSpd) + ">Evasion: " + getLetterGrade(ratRushEva));
270 | pStats.add("[B]CAREER STATS:");
271 | pStats.addAll(getCareerStatsList());
272 | return pStats;
273 | }
274 |
275 | @Override
276 | public ArrayList getCareerStatsList() {
277 | ArrayList pStats = new ArrayList<>();
278 | pStats.add("TDs: " + (statsTD+careerTDs) + ">Fumbles: " + (statsFumbles+careerFumbles));
279 | pStats.add("Rush Yards: " + (statsRushYards+careerRushYards) + " yds>Yards/Att: " + ((double)(10*(statsRushYards+careerRushYards)/(statsRushAtt+careerRushAtt+1))/10) + " yds");
280 | pStats.add("Yds/Game: " + ((statsRushYards+careerRushYards)/(getGamesPlayed()+careerGamesPlayed)) + " yds/g>Rush Att: " + (statsRushAtt+careerRushAtt));
281 | pStats.addAll(super.getCareerStatsList());
282 | return pStats;
283 | }
284 |
285 | @Override
286 | public String getInfoForLineup() {
287 | if (injury != null) return getInitialName() + " [" + getYrStr() + "] " + ratOvr + "/" + getLetterGrade(ratPot) + " " + injury.toString();
288 | return getInitialName() + " [" + getYrStr() + "] " + ratOvr + "/" + getLetterGrade(ratPot) + " (" +
289 | getLetterGrade(ratRushPow) + ", " + getLetterGrade(ratRushSpd) + ", " + getLetterGrade(ratRushEva) + ")";
290 | }
291 |
292 | }
293 |
--------------------------------------------------------------------------------